diff --git a/services/src/main/java/org/keycloak/services/messages/Messages.java b/services/src/main/java/org/keycloak/services/messages/Messages.java index 7fae66d96b..556a49548e 100755 --- a/services/src/main/java/org/keycloak/services/messages/Messages.java +++ b/services/src/main/java/org/keycloak/services/messages/Messages.java @@ -195,4 +195,5 @@ public class Messages { public static final String FAILED_LOGOUT = "failedLogout"; public static final String CONSENT_DENIED="consentDenied"; + public static final String ALREADY_LOGGED_IN="alreadyLoggedIn"; } diff --git a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java index 04debbfab6..fab58150ae 100755 --- a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java +++ b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java @@ -173,11 +173,14 @@ public class LoginActionsService { return false; } if (!clientCode.isValidAction(requiredAction)) { - if (ClientSessionModel.Action.REQUIRED_ACTIONS.name().equals(clientCode.getClientSession().getAction())) { + ClientSessionModel clientSession = clientCode.getClientSession(); + if (ClientSessionModel.Action.REQUIRED_ACTIONS.name().equals(clientSession.getAction())) { response = redirectToRequiredActions(code); return false; - } else { - invalidAction(); + } else if (clientSession.getUserSession() != null && clientSession.getUserSession().getState() == UserSessionModel.State.LOGGED_IN) { + response = session.getProvider(LoginFormsProvider.class) + .setSuccess(Messages.ALREADY_LOGGED_IN) + .createInfoPage(); return false; } } @@ -185,7 +188,7 @@ public class LoginActionsService { return true; } - public boolean isValidAction(String requiredAction) { + private boolean isValidAction(String requiredAction) { if (!clientCode.isValidAction(requiredAction)) { invalidAction(); return false; @@ -199,7 +202,7 @@ public class LoginActionsService { response = ErrorPage.error(session, Messages.INVALID_CODE); } - public boolean isActionActive(ClientSessionCode.ActionType actionType) { + private boolean isActionActive(ClientSessionCode.ActionType actionType) { if (!clientCode.isActionActive(actionType)) { event.client(clientCode.getClientSession().getClient()); event.clone().error(Errors.EXPIRED_CODE); diff --git a/themes/src/main/resources/theme/base/login/messages/messages_ca.properties b/themes/src/main/resources/theme/base/login/messages/messages_ca.properties old mode 100644 new mode 100755 index ac971e389e..df76d94a74 --- a/themes/src/main/resources/theme/base/login/messages/messages_ca.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_ca.properties @@ -196,3 +196,5 @@ backToApplication=« Torna a l''aplicaci\u00F3 missingParameterMessage=Par\u00E0metres que falten: {0} clientNotFoundMessage=Client no trobat invalidParameterMessage=Par\u00E0metre no v\u00E0lid: {0} +alreadyLoggedIn=You are already logged in. + diff --git a/themes/src/main/resources/theme/base/login/messages/messages_de.properties b/themes/src/main/resources/theme/base/login/messages/messages_de.properties old mode 100644 new mode 100755 index b696d3a65e..6993be4677 --- a/themes/src/main/resources/theme/base/login/messages/messages_de.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_de.properties @@ -191,4 +191,5 @@ invalidParameterMessage=Invalid parameter\: {0} missingParameterMessage=Missing parameter\: {0} clientNotFoundMessage=Client not found. -emailVerifiedMessage=Ihr E-Mail Adresse wurde erfolgreich verifiziert. \ No newline at end of file +emailVerifiedMessage=Ihr E-Mail Adresse wurde erfolgreich verifiziert. +alreadyLoggedIn=You are already logged in. diff --git a/themes/src/main/resources/theme/base/login/messages/messages_en.properties b/themes/src/main/resources/theme/base/login/messages/messages_en.properties index ec02b1c7ce..039e64981c 100755 --- a/themes/src/main/resources/theme/base/login/messages/messages_en.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_en.properties @@ -221,3 +221,5 @@ backToApplication=« Back to Application missingParameterMessage=Missing parameters\: {0} clientNotFoundMessage=Client not found. invalidParameterMessage=Invalid parameter\: {0} +alreadyLoggedIn=You are already logged in. + diff --git a/themes/src/main/resources/theme/base/login/messages/messages_es.properties b/themes/src/main/resources/theme/base/login/messages/messages_es.properties old mode 100644 new mode 100755 index 7dff17e345..48a5e727f7 --- a/themes/src/main/resources/theme/base/login/messages/messages_es.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_es.properties @@ -196,3 +196,5 @@ backToApplication=« Volver a la aplicaci\u00F3n missingParameterMessage=Par\u00E1metros que faltan: {0} clientNotFoundMessage=Cliente no encontrado invalidParameterMessage=Par\u00E1metro no v\u00E1lido: {0} +alreadyLoggedIn=You are already logged in. + diff --git a/themes/src/main/resources/theme/base/login/messages/messages_fr.properties b/themes/src/main/resources/theme/base/login/messages/messages_fr.properties old mode 100644 new mode 100755 index 17c3c96516..4321b2387a --- a/themes/src/main/resources/theme/base/login/messages/messages_fr.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_fr.properties @@ -210,3 +210,5 @@ backToApplication=« Revenir \u00e0 l''application missingParameterMessage=Param\u00e8tres manquants\: {0} clientNotFoundMessage=Client inconnu. invalidParameterMessage=Param\u00e8tre invalide\: {0} +alreadyLoggedIn=You are already logged in. + diff --git a/themes/src/main/resources/theme/base/login/messages/messages_it.properties b/themes/src/main/resources/theme/base/login/messages/messages_it.properties old mode 100644 new mode 100755 index c5fdbf9413..81c4caa9ef --- a/themes/src/main/resources/theme/base/login/messages/messages_it.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_it.properties @@ -189,3 +189,5 @@ backToApplication=« Torna all''Applicazione missingParameterMessage=Parametri Mancanti\: {0} clientNotFoundMessage=Client non trovato. invalidParameterMessage=Parametro non valido\: {0} +alreadyLoggedIn=You are already logged in. + diff --git a/themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties b/themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties old mode 100644 new mode 100755 index 9c78230710..08527cca59 --- a/themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties +++ b/themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties @@ -210,3 +210,5 @@ backToApplication=« Voltar para o aplicativo missingParameterMessage=Par\u00E2metros que faltam\: {0} clientNotFoundMessage=Cliente n\u00E3o encontrado. invalidParameterMessage=Par\u00E2mentro inv\u00E1lido\: {0} +alreadyLoggedIn=You are already logged in. +