KEYCLOAK-5061 Better error messages when action expired
This commit is contained in:
parent
48eaebf1c3
commit
7be2c55f61
6 changed files with 14 additions and 8 deletions
|
@ -35,6 +35,10 @@ public class Messages {
|
|||
|
||||
public static final String EXPIRED_ACTION = "expiredActionMessage";
|
||||
|
||||
public static final String EXPIRED_ACTION_TOKEN_NO_SESSION = "expiredActionTokenNoSessionMessage";
|
||||
|
||||
public static final String EXPIRED_ACTION_TOKEN_SESSION_EXISTS = "expiredActionTokenSessionExistsMessage";
|
||||
|
||||
public static final String MISSING_FIRST_NAME = "missingFirstNameMessage";
|
||||
|
||||
public static final String MISSING_LAST_NAME = "missingLastNameMessage";
|
||||
|
|
|
@ -469,10 +469,10 @@ public class LoginActionsService {
|
|||
flowPath = AUTHENTICATE_PATH;
|
||||
}
|
||||
AuthenticationProcessor.resetFlow(authSession, flowPath);
|
||||
return processAuthentication(false, null, authSession, Messages.LOGIN_TIMEOUT);
|
||||
return processAuthentication(false, null, authSession, Messages.EXPIRED_ACTION_TOKEN_SESSION_EXISTS);
|
||||
}
|
||||
|
||||
return handleActionTokenVerificationException(null, ex, Errors.EXPIRED_CODE, defaultErrorMessage);
|
||||
return handleActionTokenVerificationException(null, ex, Errors.EXPIRED_CODE, Messages.EXPIRED_ACTION_TOKEN_NO_SESSION);
|
||||
} catch (ExplainedTokenVerificationException ex) {
|
||||
return handleActionTokenVerificationException(null, ex, ex.getErrorEvent(), ex.getMessage());
|
||||
} catch (VerificationException ex) {
|
||||
|
|
|
@ -424,7 +424,7 @@ public class RequiredActionEmailVerificationTest extends AbstractTestRealmKeyclo
|
|||
driver.navigate().to(verificationUrl.trim());
|
||||
|
||||
loginPage.assertCurrent();
|
||||
assertEquals("You took too long to login. Login process starting from beginning.", loginPage.getError());
|
||||
assertEquals("Action expired. Please login again.", loginPage.getError());
|
||||
|
||||
events.expectRequiredAction(EventType.EXECUTE_ACTION_TOKEN_ERROR)
|
||||
.error(Errors.EXPIRED_CODE)
|
||||
|
@ -462,7 +462,7 @@ public class RequiredActionEmailVerificationTest extends AbstractTestRealmKeyclo
|
|||
driver.navigate().to(verificationUrl.trim());
|
||||
|
||||
errorPage.assertCurrent();
|
||||
assertEquals("The link you clicked is a old stale link and is no longer valid. Maybe you have already verified your email?", errorPage.getError());
|
||||
assertEquals("Action expired.", errorPage.getError());
|
||||
|
||||
events.expectRequiredAction(EventType.EXECUTE_ACTION_TOKEN_ERROR)
|
||||
.error(Errors.EXPIRED_CODE)
|
||||
|
|
|
@ -791,7 +791,7 @@ public class UserTest extends AbstractAdminTest {
|
|||
driver.navigate().to(link);
|
||||
|
||||
errorPage.assertCurrent();
|
||||
assertEquals("An error occurred, please login again through your application.", errorPage.getError());
|
||||
assertEquals("Action expired.", errorPage.getError());
|
||||
} finally {
|
||||
setTimeOffset(0);
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ public class ResetPasswordTest extends AbstractTestRealmKeycloakTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
assertEquals("You took too long to login. Login process starting from beginning.", loginPage.getError());
|
||||
assertEquals("Action expired. Please login again.", loginPage.getError());
|
||||
|
||||
events.expectRequiredAction(EventType.EXECUTE_ACTION_TOKEN_ERROR).error("expired_code").client((String) null).user(userId).session((String) null).clearDetails().detail(Details.ACTION, ResetCredentialsActionToken.TOKEN_TYPE).assertEvent();
|
||||
} finally {
|
||||
|
@ -407,7 +407,7 @@ public class ResetPasswordTest extends AbstractTestRealmKeycloakTest {
|
|||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
assertEquals("You took too long to login. Login process starting from beginning.", loginPage.getError());
|
||||
assertEquals("Action expired. Please login again.", loginPage.getError());
|
||||
|
||||
events.expectRequiredAction(EventType.EXECUTE_ACTION_TOKEN_ERROR).error("expired_code").client((String) null).user(userId).session((String) null).clearDetails().detail(Details.ACTION, ResetCredentialsActionToken.TOKEN_TYPE).assertEvent();
|
||||
} finally {
|
||||
|
@ -450,7 +450,7 @@ public class ResetPasswordTest extends AbstractTestRealmKeycloakTest {
|
|||
driver.navigate().to(changePasswordUrl.trim());
|
||||
|
||||
errorPage.assertCurrent();
|
||||
Assert.assertEquals("Reset Credential not allowed", errorPage.getError());
|
||||
Assert.assertEquals("Action expired.", errorPage.getError());
|
||||
String backToAppLink = errorPage.getBackToApplicationLink();
|
||||
Assert.assertTrue(backToAppLink.endsWith("/app/auth"));
|
||||
|
||||
|
|
|
@ -130,6 +130,8 @@ accountDisabledMessage=Account is disabled, contact admin.
|
|||
accountTemporarilyDisabledMessage=Account is temporarily disabled, contact admin or try again later.
|
||||
expiredCodeMessage=Login timeout. Please login again.
|
||||
expiredActionMessage=Action expired. Please continue with login now.
|
||||
expiredActionTokenNoSessionMessage=Action expired.
|
||||
expiredActionTokenSessionExistsMessage=Action expired. Please login again.
|
||||
|
||||
missingFirstNameMessage=Please specify first name.
|
||||
missingLastNameMessage=Please specify last name.
|
||||
|
|
Loading…
Reference in a new issue