Change a few rules regarding registration (login regex, password length).

migration
Philippe PITTOLI 2024-06-27 03:45:00 +02:00
parent 11f5b0872b
commit 2b33f362dd
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class AuthD::Request
return Response::ErrorAlreadyUsedLogin.new
end
acceptable_login_regex = "[a-zA-Z][-_ a-zA-Z0-9']+"
acceptable_login_regex = "[a-zA-Z][-_ a-zA-Z0-9']*[a-zA-Z0-9]"
pattern = Regex.new acceptable_login_regex, Regex::Options::IGNORE_CASE
return Response::ErrorInvalidLoginFormat.new unless pattern =~ @login
@ -35,7 +35,7 @@ class AuthD::Request
end
# In this case we should not accept its registration.
return Response::ErrorPasswordTooShort.new if @password.size < 20
return Response::ErrorPasswordTooShort.new if @password.size < 15
return Response::ErrorPasswordTooLong.new if @password.size > 100
uid = authd.new_uid