diff options
author | 2002-01-28 17:59:09 +0000 | |
---|---|---|
committer | 2002-01-28 17:59:09 +0000 | |
commit | ee6068b5a7f0eefa3967019282f9bd398d9a1e19 (patch) | |
tree | 10ead11fe0bba3fa9846c0c5edece7624cb8b5fd /adduser/adduser.perl | |
parent | b64e34064a4617cbdd220db4b923fa317a8e51c2 (diff) | |
download | pw-darwin-ee6068b5a7f0eefa3967019282f9bd398d9a1e19.tar.gz pw-darwin-ee6068b5a7f0eefa3967019282f9bd398d9a1e19.tar.zst pw-darwin-ee6068b5a7f0eefa3967019282f9bd398d9a1e19.zip |
Keep similar things together: Check for too long usernames
inside the function that verifies username validity.
Diffstat (limited to 'adduser/adduser.perl')
-rw-r--r-- | adduser/adduser.perl | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/adduser/adduser.perl b/adduser/adduser.perl index 2aa9c31..322bac6 100644 --- a/adduser/adduser.perl +++ b/adduser/adduser.perl @@ -317,10 +317,6 @@ sub new_users_name { while(1) { $name = &confirm_list("Enter username", 1, $usernameregexp, ""); - if (length($name) > 16) { - warn "Username is longer than 16 chars\a\n"; - next; - } last if (&new_users_name_valid($name)); } return $name; @@ -332,6 +328,9 @@ sub new_users_name_valid { if ($name eq $usernameregexp) { # user/admin just pressed <Return> warn "Please enter a username\a\n"; return 0; + } elsif (length($name) > 16) { + warn "Username is longer than 16 characters.\a\n"; + return 0; } elsif ($name =~ /[:\n]/) { warn "Username cannot contain colon or newline characters.\a\n"; return 0; |