From 29740349743eb2ebc2d002b556ab885824df3c3f Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Wed, 3 Feb 2016 13:41:31 +0100 Subject: [PATCH] KEYCLOAK-2435 Feedback on login screen not showing correctly --- .../java/org/keycloak/forms/login/LoginFormsProvider.java | 2 ++ .../authenticators/broker/IdpUsernamePasswordForm.java | 2 +- .../login/freemarker/FreeMarkerLoginFormsProvider.java | 6 ++++++ .../src/main/java/org/keycloak/theme/beans/MessageType.java | 2 +- themes/src/main/resources/theme/base/login/template.ftl | 1 + .../main/resources/theme/keycloak/login/theme.properties | 3 ++- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java b/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java index a89bfc187f..88b309e960 100755 --- a/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java +++ b/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java @@ -109,6 +109,8 @@ public interface LoginFormsProvider extends Provider { public LoginFormsProvider setSuccess(String message, Object ... parameters); + public LoginFormsProvider setInfo(String message, Object ... parameters); + public LoginFormsProvider setUser(UserModel user); public LoginFormsProvider setResponseHeader(String headerName, String headerValue); diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java index 7bcf018a6b..5b0e1523b3 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java @@ -67,6 +67,6 @@ public class IdpUsernamePasswordForm extends UsernamePasswordForm { return context.form() .setFormData(formData) .setAttribute(LoginFormsProvider.USERNAME_EDIT_DISABLED, true) - .setSuccess(Messages.FEDERATED_IDENTITY_CONFIRM_REAUTHENTICATE_MESSAGE, existingUser.getUsername(), serializedCtx.getIdentityProviderId()); + .setInfo(Messages.FEDERATED_IDENTITY_CONFIRM_REAUTHENTICATE_MESSAGE, existingUser.getUsername(), serializedCtx.getIdentityProviderId()); } } diff --git a/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java b/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java index bbbbc23b69..bb2e518d9c 100755 --- a/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java +++ b/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java @@ -569,6 +569,12 @@ public class FreeMarkerLoginFormsProvider implements LoginFormsProvider { return this; } + @Override + public FreeMarkerLoginFormsProvider setInfo(String message, Object... parameters) { + setMessage(MessageType.INFO, message, parameters); + return this; + } + @Override public FreeMarkerLoginFormsProvider setUser(UserModel user) { this.user = user; diff --git a/services/src/main/java/org/keycloak/theme/beans/MessageType.java b/services/src/main/java/org/keycloak/theme/beans/MessageType.java index 375119b0fb..da37816620 100755 --- a/services/src/main/java/org/keycloak/theme/beans/MessageType.java +++ b/services/src/main/java/org/keycloak/theme/beans/MessageType.java @@ -23,6 +23,6 @@ package org.keycloak.theme.beans; */ public enum MessageType { - SUCCESS, WARNING, ERROR + SUCCESS, WARNING, INFO, ERROR } diff --git a/themes/src/main/resources/theme/base/login/template.ftl b/themes/src/main/resources/theme/base/login/template.ftl index 57aab78471..a999fd8f8c 100755 --- a/themes/src/main/resources/theme/base/login/template.ftl +++ b/themes/src/main/resources/theme/base/login/template.ftl @@ -62,6 +62,7 @@ <#if message.type = 'success'> <#if message.type = 'warning'> <#if message.type = 'error'> + <#if message.type = 'info'> ${message.summary} diff --git a/themes/src/main/resources/theme/keycloak/login/theme.properties b/themes/src/main/resources/theme/keycloak/login/theme.properties index 8891151882..f6274f1d21 100644 --- a/themes/src/main/resources/theme/keycloak/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak/login/theme.properties @@ -20,7 +20,8 @@ kcFormAreaClass=col-xs-12 col-sm-8 col-md-8 col-lg-7 login kcFeedbackErrorIcon=pficon pficon-error-circle-o kcFeedbackWarningIcon=pficon pficon-warning-triangle-o -kcFeedbackSuccessIcon=alert alert-success +kcFeedbackSuccessIcon=pficon pficon-ok +kcFeedbackInfoIcon=pficon pficon-info kcFormClass=form-horizontal