Merge pull request #3233 from betovieirasilva/master-KEYCLOAK-LoginUsername
[PULL-REQUEST-3181 & PULL-REQUEST-3233] Username is not displayed on the login screen with that email
This commit is contained in:
commit
44c47431a1
2 changed files with 35 additions and 1 deletions
|
@ -408,7 +408,7 @@ public class AuthenticationManager {
|
||||||
// refresh the cookies!
|
// refresh the cookies!
|
||||||
createLoginCookie(session, realm, userSession.getUser(), userSession, uriInfo, clientConnection);
|
createLoginCookie(session, realm, userSession.getUser(), userSession, uriInfo, clientConnection);
|
||||||
if (userSession.getState() != UserSessionModel.State.LOGGED_IN) userSession.setState(UserSessionModel.State.LOGGED_IN);
|
if (userSession.getState() != UserSessionModel.State.LOGGED_IN) userSession.setState(UserSessionModel.State.LOGGED_IN);
|
||||||
if (userSession.isRememberMe()) createRememberMeCookie(realm, userSession.getUser().getUsername(), uriInfo, clientConnection);
|
if (userSession.isRememberMe()) createRememberMeCookie(realm, userSession.getLoginUsername(), uriInfo, clientConnection);
|
||||||
|
|
||||||
// Update userSession note with authTime. But just if flag SSO_AUTH is not set
|
// Update userSession note with authTime. But just if flag SSO_AUTH is not set
|
||||||
if (!isSSOAuthentication(clientSession)) {
|
if (!isSSOAuthentication(clientSession)) {
|
||||||
|
|
|
@ -480,6 +480,40 @@ public class LoginTest extends TestRealmKeycloakTest {
|
||||||
setRememberMe(false);
|
setRememberMe(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
// KEYCLOAK-3181
|
||||||
|
public void loginWithEmailUserAndRememberMe() {
|
||||||
|
setRememberMe(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
loginPage.open();
|
||||||
|
loginPage.setRememberMe(true);
|
||||||
|
assertTrue(loginPage.isRememberMeChecked());
|
||||||
|
loginPage.login("login@test.com", "password");
|
||||||
|
|
||||||
|
Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());
|
||||||
|
Assert.assertNotNull(oauth.getCurrentQuery().get(OAuth2Constants.CODE));
|
||||||
|
EventRepresentation loginEvent = events.expectLogin().user(userId)
|
||||||
|
.detail(Details.USERNAME, "login@test.com")
|
||||||
|
.detail(Details.REMEMBER_ME, "true")
|
||||||
|
.assertEvent();
|
||||||
|
String sessionId = loginEvent.getSessionId();
|
||||||
|
|
||||||
|
// Expire session
|
||||||
|
testingClient.testing().removeUserSession("test", sessionId);
|
||||||
|
|
||||||
|
// Assert rememberMe checked and username/email prefilled
|
||||||
|
loginPage.open();
|
||||||
|
assertTrue(loginPage.isRememberMeChecked());
|
||||||
|
|
||||||
|
Assert.assertEquals("login@test.com", loginPage.getUsername());
|
||||||
|
|
||||||
|
loginPage.setRememberMe(false);
|
||||||
|
} finally {
|
||||||
|
setRememberMe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// KEYCLOAK-1037
|
// KEYCLOAK-1037
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue