Client: better error messages for register operation.

master
Philippe Pittoli 2023-06-15 01:11:16 +02:00
parent f24926fe1a
commit ecc2290a09
1 changed files with 8 additions and 8 deletions

View File

@ -101,28 +101,28 @@ class Actions
res = authd.register login, password.not_nil!, email, profile: profile res = authd.register login, password.not_nil!, email, profile: profile
case res case res
when Response::UserAdded when Response::UserAdded
Baguette::Log.info "User registered, mail sent" Baguette::Log.info "user registered, mail sent"
exit 0 exit 0
when Response::ErrorRegistrationsClosed when Response::ErrorRegistrationsClosed
Baguette::Log.error "ErrorRegistrationsClosed" Baguette::Log.error "registrations are closed (only admins can add users)"
exit 1 exit 1
when Response::ErrorAlreadyUsedLogin when Response::ErrorAlreadyUsedLogin
Baguette::Log.error "ErrorAlreadyUsedLogin" Baguette::Log.error "login already used"
exit 1 exit 1
when Response::ErrorMailRequired when Response::ErrorMailRequired
Baguette::Log.error "ErrorMailRequired" Baguette::Log.error "an email address is required"
exit 1 exit 1
when Response::ErrorInvalidEmailFormat when Response::ErrorInvalidEmailFormat
Baguette::Log.error "ErrorInvalidEmailFormat" Baguette::Log.error "provided email address has an invalid format"
exit 1 exit 1
when Response::ErrorCannotContactUser when Response::ErrorCannotContactUser
Baguette::Log.error "ErrorCannotContactUser" Baguette::Log.error "an error occured while contacting the user with this email address"
exit 1 exit 1
when Response::ErrorInvalidLoginFormat when Response::ErrorInvalidLoginFormat
Baguette::Log.warning "Invalid login!" Baguette::Log.error "invalid login"
exit 1 exit 1
when Response::ErrorPasswordTooShort when Response::ErrorPasswordTooShort
Baguette::Log.warning "Password too short!" Baguette::Log.error "password too short"
exit 1 exit 1
end end
rescue e rescue e