mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Keep similar things together: Check for too long usernames
inside the function that verifies username validity.
This commit is contained in:
parent
76ed1f96fd
commit
8335d0edc2
1 changed files with 3 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue