diff --git a/forms/src/main/java/org/keycloak/service/FormServiceImpl.java b/forms/src/main/java/org/keycloak/service/FormServiceImpl.java index 7efa87dab3..3dedc5e0d8 100644 --- a/forms/src/main/java/org/keycloak/service/FormServiceImpl.java +++ b/forms/src/main/java/org/keycloak/service/FormServiceImpl.java @@ -65,12 +65,12 @@ public class FormServiceImpl implements FormService { commandMap.put(Pages.LOGIN_RESET_PASSWORD, new CommandPassword()); commandMap.put(Pages.LOGIN_UPDATE_PASSWORD, new CommandPassword()); commandMap.put(Pages.ACCESS, new CommandAccess()); - commandMap.put(Pages.SECURITY_FAILURE, new CommandSecurityFailure()); commandMap.put(Pages.SOCIAL, new CommandSocial()); commandMap.put(Pages.TOTP, new CommandTotp()); commandMap.put(Pages.LOGIN_CONFIG_TOTP, new CommandTotp()); commandMap.put(Pages.LOGIN_TOTP, new CommandLoginTotp()); commandMap.put(Pages.LOGIN_VERIFY_EMAIL, new CommandLoginTotp()); + commandMap.put(Pages.ERROR, new CommandError()); } public String getId(){ @@ -143,11 +143,6 @@ public class FormServiceImpl implements FormService { } } - private class CommandSecurityFailure implements Command { - public void exec(Map attributes, FormServiceDataBean dataBean) { - } - } - private class CommandPassword implements Command { public void exec(Map attributes, FormServiceDataBean dataBean) { if (dataBean.getError() != null){ @@ -253,6 +248,14 @@ public class FormServiceImpl implements FormService { } } + private class CommandError implements Command { + public void exec(Map attributes, FormServiceDataBean dataBean) { + if (dataBean.getError() != null){ + attributes.put("error", new ErrorBean(dataBean.getError())); + } + } + } + private interface Command { public void exec(Map attributes, FormServiceDataBean dataBean); } diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/error.ftl b/forms/src/main/resources/META-INF/resources/forms/theme/default/error.ftl index a7f1f5be91..64ca460b7a 100755 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/error.ftl +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/error.ftl @@ -1,6 +1,6 @@ <#-- TODO: Only a placeholder, implementation needed --> <#import "template-login-action.ftl" as layout> -<@layout.registrationLayout bodyClass="reset"; section> +<@layout.registrationLayout bodyClass="reset" isErrorPage=true; section> <#if section = "title"> We're sorry... @@ -12,7 +12,7 @@ <#elseif section = "form">

Something happened and we could not process your request.

-

Please make sure the URL you entered is correct.

+

${error.summary}

Go to the homepage ยป <#elseif section = "info" > diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login-action.ftl b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login-action.ftl index 70794b16cd..c2920cf57f 100644 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login-action.ftl +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login-action.ftl @@ -1,4 +1,4 @@ -<#macro registrationLayout bodyClass> +<#macro registrationLayout bodyClass isErrorPage=false> @@ -37,7 +37,7 @@ <#nested "form"> - <#if error?has_content> + <#if !isErrorPage && error?has_content>