You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you login to Fennec using GitHub and then change the (primary) email address of your account. All future login attempts will fail. As the emails do not match Fennec thinks it is a new user but can not create that user because the username already exists.
The text was updated successfully, but these errors were encountered:
The related function loadUserByOAuthUserResponse() in src/AppBundle/Security/Core/user/FOSUBUserProvider.php gets the current user from the OAuth response.
At the moment we are saving the email address and username from the response. It is important to know that here the username is NOT the nickname of the Fennec user but an identifier like 123456789.
If the user has changed his email, we check if there is an user with the username 123456789 which is not found. Instead we could replace the username by the nickname which is described in the following example. Then it is possible to login with github after the email address has changed.
publicfunctionloadUserByOAuthUserResponse(UserResponseInterface$response)
{
$userEmail = $response->getEmail();
//change the following line to $username = $response->getNickname()$username = $response->getUsername();
//if the user has changed his email adress $user is null$user = $this->userManager->findUserByEmail($userEmail);
//check if we can find a Fennec user related to the username of the github userif(null === $user){
$user = $this->userManager->findUserByUsername($username);
}
//if null create new user and set its propertiesif(null === $user){
...
}
//get service and update access tokenreturn$user;
}
Probably this will not work if the user changes his email address and its username... so we should discuss and think about changing the structure of this function 🙂
If you login to Fennec using GitHub and then change the (primary) email address of your account. All future login attempts will fail. As the emails do not match Fennec thinks it is a new user but can not create that user because the username already exists.
The text was updated successfully, but these errors were encountered: