publish username rules in registration failure

This commit is contained in:
Fabio Bas 2015-06-29 23:35:27 +02:00
parent 9947af7be9
commit 4c27304047
5 changed files with 57 additions and 12 deletions

View file

@ -788,8 +788,14 @@ Response::ResponseCode ServerSocketInterface::cmdRegisterAccount(const Command_R
}
// TODO: Move this method outside of the db interface
if (!sqlInterface->usernameIsValid(userName))
QString errorString;
if (!sqlInterface->usernameIsValid(userName, errorString))
{
Response_Register *re = new Response_Register;
re->set_denied_reason_str(errorString.toStdString());
rc.setResponseExtension(re);
return Response::RespUsernameInvalid;
}
if(sqlInterface->userExists(userName))
return Response::RespUserAlreadyExists;