KEYCLOAK-11921 Reset password (#6505)

This commit is contained in:
Tomas Kyjovsky 2019-11-28 09:38:12 +01:00 committed by Marek Posolda
parent 9a5fda5ec9
commit 61eb569ae5
3 changed files with 8 additions and 8 deletions

View file

@ -82,7 +82,6 @@ public class UserCredentials extends User {
}
public void resetPassword(String newPassword, String confirmPassword) {
deletePassword();
setNewPassword(newPassword);
setConfirmPassword(confirmPassword);
resetPasswordButton.click();

View file

@ -656,12 +656,13 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, $route, R
}
}
var msgTitle = 'Set password';
var msg = 'Are you sure you want to set a password for the user?';
var msgTitle = ($scope.hasPassword ? 'Reset' : 'Set') + ' password';
var msg = 'Are you sure you want to ' + ($scope.hasPassword ? 'reset' : 'set') + ' a password for the user?';
var msgSuccess = 'The password has been ' + ($scope.hasPassword ? 'reset.' : 'set.');
Dialog.confirm(msgTitle, msg, function() {
UserCredentials.resetPassword({ realm: realm.realm, userId: user.id }, { type : "password", value : $scope.password, temporary: $scope.temporaryPassword }, function() {
Notifications.success("The password has been set");
Notifications.success(msgSuccess);
$scope.password = null;
$scope.confirmPassword = null;
$route.reload();

View file

@ -55,8 +55,8 @@
</table>
</fieldset>
<fieldset class="border-top" data-ng-show="!hasPassword">
<legend><span class="text">{{:: 'set-password' | translate}}</span></legend>
<fieldset class="border-top">
<legend><span class="text">{{ (hasPassword ? 'reset-password' : 'set-password') | translate }}</span></legend>
<div class="form-group">
<label class="col-md-2 control-label" for="newPas">{{:: 'password' | translate}} <span class="required" data-ng-show="create">*</span></label>
<div class="col-md-6">
@ -81,7 +81,7 @@
<div class="form-group">
<div class="col-md-10 col-md-offset-2">
<button data-ng-disabled="!passwordAndConfirmPasswordEntered()" class="btn btn-default" type="submit" data-ng-click="resetPassword(true)">{{:: 'set-password' | translate}}</button>
<button data-ng-disabled="!passwordAndConfirmPasswordEntered()" class="btn btn-default" type="submit" data-ng-click="resetPassword(true)">{{ (hasPassword ? 'reset-password' : 'set-password') | translate }}</button>
</div>
</div>
</fieldset>