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 @@