Using "Account is disabled" message (and also added new test case)
This commit is contained in:
parent
f06d7f8eb6
commit
7b8dcb42ea
2 changed files with 20 additions and 1 deletions
|
@ -153,7 +153,7 @@ public class LoginActionsServiceChecks {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! user.isEnabled()) {
|
if (! user.isEnabled()) {
|
||||||
throw new ExplainedVerificationException(Errors.USER_DISABLED, Messages.INVALID_USER);
|
throw new ExplainedVerificationException(Errors.USER_DISABLED, Messages.ACCOUNT_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userSetter != null) {
|
if (userSetter != null) {
|
||||||
|
|
|
@ -958,6 +958,25 @@ public class ResetPasswordTest extends AbstractTestRealmKeycloakTest {
|
||||||
events.expectLogin().user(userId).detail(Details.USERNAME, "login-test").assertEvent();
|
events.expectLogin().user(userId).detail(Details.USERNAME, "login-test").assertEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void resetPasswordBeforeUserIsDisabled() throws IOException, MessagingException {
|
||||||
|
initiateResetPasswordFromResetPasswordPage("login-test");
|
||||||
|
|
||||||
|
assertEquals(1, greenMail.getReceivedMessages().length);
|
||||||
|
MimeMessage message = greenMail.getReceivedMessages()[0];
|
||||||
|
String changePasswordUrl = MailUtils.getPasswordResetEmailLink(message);
|
||||||
|
events.expectRequiredAction(EventType.SEND_RESET_PASSWORD).session((String)null).user(userId).detail(Details.USERNAME, "login-test").detail(Details.EMAIL, "login@test.com").assertEvent();
|
||||||
|
|
||||||
|
UserRepresentation user = findUser("login-test");
|
||||||
|
user.setEnabled(false);
|
||||||
|
updateUser(user);
|
||||||
|
|
||||||
|
driver.navigate().to(changePasswordUrl.trim());
|
||||||
|
|
||||||
|
errorPage.assertCurrent();
|
||||||
|
assertEquals("Account is disabled, contact your administrator.", errorPage.getError());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resetPasswordWithPasswordHistoryPolicy() throws IOException, MessagingException {
|
public void resetPasswordWithPasswordHistoryPolicy() throws IOException, MessagingException {
|
||||||
//Block passwords that are equal to previous passwords. Default value is 3.
|
//Block passwords that are equal to previous passwords. Default value is 3.
|
||||||
|
|
Loading…
Reference in a new issue