Skip to content

Commit

Permalink
Fixed email case-sensitivity problems
Browse files Browse the repository at this point in the history
Logging in with a capital letter in the email caused a different hash to be produced compared to the has produced by the email which is returned by the server, since the server email is always automatically lower case
  • Loading branch information
DavidLazarescu committed May 24, 2023
1 parent b9752c3 commit 901bc84
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/adapters/controllers/authentication_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ void AuthenticationController::loginUser(const QString& email,
const QString& password,
bool rememberUser)
{
LoginModel loginModel(email, password, rememberUser);
// Make sure that the email is always lower-case
auto fixedEmail = email.toLower();
LoginModel loginModel(fixedEmail, password, rememberUser);

m_authenticationService->loginUser(loginModel);
}
Expand All @@ -46,10 +48,12 @@ void AuthenticationController::registerUser(const QString& firstName,
const QString& email,
QString password, bool keepUpdated)
{
RegisterModel registerModel(firstName, lastName, email, password,
keepUpdated);
// Make sure that the email is always lower-case
auto fixedEmail = email.toLower();
RegisterModel registerModel(firstName, lastName, fixedEmail, password,
keepUpdated);

m_authenticationService->registerUser(registerModel);
}

} // namespace adapters::controllers
} // namespace adapters::controllers

0 comments on commit 901bc84

Please sign in to comment.