Merge pull request #1562 from velias/KEYCLOAK-1741
KEYCLOAK-1741 - Login form keeps "Username or email" field value after reshown due validation error
This commit is contained in:
commit
24147a3d84
3 changed files with 25 additions and 0 deletions
|
@ -419,6 +419,7 @@ public class AuthenticationProcessor {
|
|||
LoginFormsProvider provider = getSession().getProvider(LoginFormsProvider.class)
|
||||
.setUser(getUser())
|
||||
.setActionUri(action)
|
||||
.setFormData(request.getDecodedFormParameters())
|
||||
.setClientSessionCode(accessCode);
|
||||
if (getForwardedErrorMessage() != null) {
|
||||
provider.addError(getForwardedErrorMessage());
|
||||
|
|
|
@ -129,6 +129,10 @@ public class LoginTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
// KEYCLOAK-1741 - assert form field values kept
|
||||
Assert.assertEquals("login-test", loginPage.getUsername());
|
||||
Assert.assertEquals("", loginPage.getPassword());
|
||||
|
||||
Assert.assertEquals("Invalid username or password.", loginPage.getError());
|
||||
|
||||
events.expectLogin().user(userId).session((String) null).error("invalid_user_credentials")
|
||||
|
@ -144,6 +148,10 @@ public class LoginTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
// KEYCLOAK-1741 - assert form field values kept
|
||||
Assert.assertEquals("login-test", loginPage.getUsername());
|
||||
Assert.assertEquals("", loginPage.getPassword());
|
||||
|
||||
Assert.assertEquals("Invalid username or password.", loginPage.getError());
|
||||
|
||||
events.expectLogin().user(userId).session((String) null).error("invalid_user_credentials")
|
||||
|
@ -167,6 +175,10 @@ public class LoginTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
// KEYCLOAK-1741 - assert form field values kept
|
||||
Assert.assertEquals("login-test", loginPage.getUsername());
|
||||
Assert.assertEquals("", loginPage.getPassword());
|
||||
|
||||
Assert.assertEquals("Account is disabled, contact admin.", loginPage.getError());
|
||||
|
||||
events.expectLogin().user(userId).session((String) null).error("user_disabled")
|
||||
|
@ -198,6 +210,10 @@ public class LoginTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
// KEYCLOAK-1741 - assert form field values kept
|
||||
Assert.assertEquals("login-test", loginPage.getUsername());
|
||||
Assert.assertEquals("", loginPage.getPassword());
|
||||
|
||||
Assert.assertEquals("Account is disabled, contact admin.", loginPage.getError());
|
||||
|
||||
events.expectLogin().user(userId).session((String) null).error("user_disabled")
|
||||
|
@ -221,6 +237,10 @@ public class LoginTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
// KEYCLOAK-1741 - assert form field values kept
|
||||
Assert.assertEquals("invalid", loginPage.getUsername());
|
||||
Assert.assertEquals("", loginPage.getPassword());
|
||||
|
||||
Assert.assertEquals("Invalid username or password.", loginPage.getError());
|
||||
|
||||
events.expectLogin().user((String) null).session((String) null).error("user_not_found")
|
||||
|
|
|
@ -112,6 +112,10 @@ public class LoginPage extends AbstractPage {
|
|||
return usernameInput.getAttribute("value");
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return passwordInput.getAttribute("value");
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
cancelButton.click();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue