diff --git a/core/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java index 99237ee23f..406ded3ac1 100755 --- a/core/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java @@ -20,6 +20,8 @@ public class CredentialRepresentation { protected String hashedSaltedValue; protected String salt; protected Integer hashIterations; + // only used when updating a credential. Might set required action + protected boolean temporary; public String getType() { return type; @@ -68,4 +70,12 @@ public class CredentialRepresentation { public void setHashIterations(Integer hashIterations) { this.hashIterations = hashIterations; } + + public boolean isTemporary() { + return temporary; + } + + public void setTemporary(boolean temporary) { + this.temporary = temporary; + } } diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js index 52a933f90a..c4f7375dcd 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js @@ -267,7 +267,7 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use $scope.isTotp = user.totp; } - $scope.resetPassword = function() { + $scope.resetPassword = function(temporary) { if ($scope.pwdChange) { if ($scope.password != $scope.confirmPassword) { Notifications.error("Password and confirmation does not match."); @@ -275,8 +275,15 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use } } - Dialog.confirm('Reset password', 'Are you sure you want to reset the users password?', function() { - UserCredentials.resetPassword({ realm: realm.realm, userId: user.username }, { type : "password", value : $scope.password }, function() { + var msgTitle = 'Change password'; + var msg = 'Are you sure you want to change the users password?'; + if (temporary) { + msgTitle = 'Reset password'; + msg = 'Are you sure you want to reset the users password?'; + } + + Dialog.confirm(msgTitle, msg, function() { + UserCredentials.resetPassword({ realm: realm.realm, userId: user.username }, { type : "password", value : $scope.password, temporary: temporary }, function() { Notifications.success("The password has been reset"); $scope.password = null; $scope.confirmPassword = null; diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html index 0bea3618ad..a29215ac58 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html @@ -12,7 +12,7 @@

-

{{application.name}} Allowed Claims

+

{{application.name}} Allowed Claims

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html index 517556a281..741f53f733 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html @@ -32,13 +32,14 @@
-
+
+
-
+
+
@@ -84,6 +88,7 @@
+
@@ -107,6 +112,7 @@
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html index 7a32fea681..4187bf963d 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html @@ -14,7 +14,7 @@

-

{{application.name}} Installation

+

{{application.name}} Installation

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html index 892e4b87a6..37cb2ab557 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html @@ -5,7 +5,7 @@

-

{{realm.realm}} Applications

+

{{realm.realm}} Applications

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html index 3353a93845..9670154138 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html @@ -20,6 +20,7 @@
+
@@ -27,7 +28,7 @@ -
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html index 128729e949..bca7267321 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html @@ -13,7 +13,7 @@

-

{{application.name}} Roles

+

{{application.name}} Application Roles

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html index f466b9b5c2..1aca4f46a0 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html @@ -13,7 +13,7 @@

-

{{application.name}} Scope Mappings

+

{{application.name}} Scope Mappings

@@ -22,17 +22,18 @@
+
- Realm Roles + Realm Roles
- +
- +
- -
- +

-

{{application.name}} Sessions

+

{{application.name}} Sessions

@@ -20,15 +20,16 @@
+
- + @@ -38,7 +39,7 @@ - +
Session Start
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html index 6bf63c414c..756a45159a 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html @@ -10,7 +10,7 @@

-

{{oauth.name}} Allowed Claims

+

{{oauth.name}} Allowed Claims

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html index 1cfd8bfba4..76167450eb 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html @@ -35,6 +35,7 @@
+
@@ -47,12 +48,14 @@
+
+
@@ -76,6 +79,7 @@
+
@@ -99,6 +103,7 @@
+ diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html index 5e02fb972d..f20e8ba2e4 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html @@ -10,7 +10,7 @@

-

OAuth Client Installation

+

OAuth Client Installation

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html index 06c8456105..a19323f4cf 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html @@ -5,7 +5,7 @@

-

{{realm.realm}} OAuth Clients

+

{{realm.realm}} OAuth Clients

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html index fbde66a855..16941d66b9 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html @@ -18,6 +18,7 @@
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html index b49566c80e..707cc3d2f6 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html @@ -11,7 +11,7 @@

-

{{oauth.name}} Scope Mappings

+

{{oauth.name}} Scope Mappings

@@ -20,16 +20,17 @@
+
- Realm Roles + Realm Roles
- +
- +
- -
- + {{realm.realm}} Credentials
- Realm Credentials Settings + Realm Credentials Settings
@@ -17,7 +17,7 @@
- Realm Password Policy + Realm Password Policy
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html index 74027d288b..a8af7dd7e1 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html @@ -51,9 +51,9 @@ - +
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html index 38eda81b77..b56dcc4c7f 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html @@ -3,7 +3,7 @@

-

{{realm.realm}} Realm Public Key

+

{{realm.realm}} Realm Public Key

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html index 3e071ab9af..39768aac6c 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html @@ -12,14 +12,14 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+ - + +
-
- +
+
-
- +
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html index de468c4bf2..7b1e10c5ce 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html @@ -23,14 +23,14 @@
-
+
-
+
@@ -40,7 +40,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
@@ -64,22 +64,23 @@
-
+
-
-
+
+
@@ -89,7 +90,7 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html index 376597a94e..a291b64e85 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html @@ -36,7 +36,7 @@
- +
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java index 278bc29736..628ef9a7c4 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java @@ -775,7 +775,7 @@ public class UsersResource { UserCredentialModel cred = RepresentationToModel.convertCredential(pass); session.users().updateCredential(realm, user, cred); - user.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD); + if (pass.isTemporary()) user.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD); } /**