diff --git a/services/src/main/java/org/keycloak/authentication/requiredactions/UpdatePassword.java b/services/src/main/java/org/keycloak/authentication/requiredactions/UpdatePassword.java index 6c7f7451af..1e9f37a146 100755 --- a/services/src/main/java/org/keycloak/authentication/requiredactions/UpdatePassword.java +++ b/services/src/main/java/org/keycloak/authentication/requiredactions/UpdatePassword.java @@ -75,6 +75,7 @@ public class UpdatePassword implements RequiredActionProvider, RequiredActionFac @Override public void requiredActionChallenge(RequiredActionContext context) { Response challenge = context.form() + .setAttribute("username", context.getAuthenticationSession().getAuthenticatedUser().getUsername()) .createResponse(UserModel.RequiredAction.UPDATE_PASSWORD); context.challenge(challenge); } @@ -93,6 +94,7 @@ public class UpdatePassword implements RequiredActionProvider, RequiredActionFac if (Validation.isBlank(passwordNew)) { Response challenge = context.form() + .setAttribute("username", context.getAuthenticationSession().getAuthenticatedUser().getUsername()) .setError(Messages.MISSING_PASSWORD) .createResponse(UserModel.RequiredAction.UPDATE_PASSWORD); context.challenge(challenge); @@ -100,6 +102,7 @@ public class UpdatePassword implements RequiredActionProvider, RequiredActionFac return; } else if (!passwordNew.equals(passwordConfirm)) { Response challenge = context.form() + .setAttribute("username", context.getAuthenticationSession().getAuthenticatedUser().getUsername()) .setError(Messages.NOTMATCH_PASSWORD) .createResponse(UserModel.RequiredAction.UPDATE_PASSWORD); context.challenge(challenge); @@ -113,6 +116,7 @@ public class UpdatePassword implements RequiredActionProvider, RequiredActionFac } catch (ModelException me) { errorEvent.detail(Details.REASON, me.getMessage()).error(Errors.PASSWORD_REJECTED); Response challenge = context.form() + .setAttribute("username", context.getAuthenticationSession().getAuthenticatedUser().getUsername()) .setError(me.getMessage(), me.getParameters()) .createResponse(UserModel.RequiredAction.UPDATE_PASSWORD); context.challenge(challenge); @@ -120,6 +124,7 @@ public class UpdatePassword implements RequiredActionProvider, RequiredActionFac } catch (Exception ape) { errorEvent.detail(Details.REASON, ape.getMessage()).error(Errors.PASSWORD_REJECTED); Response challenge = context.form() + .setAttribute("username", context.getAuthenticationSession().getAuthenticatedUser().getUsername()) .setError(ape.getMessage()) .createResponse(UserModel.RequiredAction.UPDATE_PASSWORD); context.challenge(challenge); diff --git a/themes/src/main/resources/theme/base/account/password.ftl b/themes/src/main/resources/theme/base/account/password.ftl index 26b21ea38e..4a043f28b9 100755 --- a/themes/src/main/resources/theme/base/account/password.ftl +++ b/themes/src/main/resources/theme/base/account/password.ftl @@ -11,8 +11,7 @@
- - + <#if password.passwordSet>
@@ -21,7 +20,7 @@
- +
@@ -34,7 +33,7 @@
- +
@@ -44,7 +43,7 @@
- +
@@ -57,4 +56,4 @@
- \ No newline at end of file + diff --git a/themes/src/main/resources/theme/base/login/login-update-password.ftl b/themes/src/main/resources/theme/base/login/login-update-password.ftl index 1dece7f3da..2ec37fb16b 100755 --- a/themes/src/main/resources/theme/base/login/login-update-password.ftl +++ b/themes/src/main/resources/theme/base/login/login-update-password.ftl @@ -6,15 +6,15 @@ ${msg("updatePasswordTitle")} <#elseif section = "form">
- - + +
- +
@@ -23,7 +23,7 @@
- +
@@ -39,4 +39,4 @@
- \ No newline at end of file + diff --git a/themes/src/main/resources/theme/base/login/register.ftl b/themes/src/main/resources/theme/base/login/register.ftl index f7d0dbd818..0ac0ab3446 100755 --- a/themes/src/main/resources/theme/base/login/register.ftl +++ b/themes/src/main/resources/theme/base/login/register.ftl @@ -6,19 +6,6 @@ ${msg("registerWithTitleHtml",(realm.displayNameHtml!''))?no_esc} <#elseif section = "form">
- - - - <#if !realm.registrationEmailAsUsername> -
-
- -
-
- -
-
-
@@ -42,17 +29,28 @@
- +
+ <#if !realm.registrationEmailAsUsername> +
+
+ +
+
+ +
+
+ + <#if passwordRequired>
- +