Limit character set for new usernames

This commit is contained in:
Juerd Waalboer 2023-12-26 16:17:26 +01:00
parent 344e7baabc
commit 98af489386
2 changed files with 12 additions and 10 deletions

View file

@ -15,13 +15,13 @@ sub command :Tab(adduser) ($self, $cart, $command, @) {
}
sub username($self, $cart, $name, @) {
return REJECT, "Sorry, whitespace is not allowed."
if $name =~ /\s/;
return REJECT, "Sorry, only A-Z a-z 0-9 _ - + / ^ * [] {} are allowed."
if $name !~ /^[A-Za-z0-9_\-+\/\^*\[\]{}-]+\z/;
return REJECT, "Sorry, invalid first character."
if $name =~ /^[-+*]/;
return REJECT, "Sorry, - + / ^ * are not allowed as the first character."
if $name =~ /^[-+*\/\^]/;
return REJECT, "That's too numeric to be a user name."
return REJECT, "Sorry, that's too numeric to be a user name."
if defined parse_amount($name);
return REJECT, "That name already exists."