Clean user credential management form
This commit is contained in:
parent
e0542b5260
commit
a3c982a630
2 changed files with 30 additions and 14 deletions
|
@ -265,13 +265,14 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use
|
||||||
|
|
||||||
$scope.realm = realm;
|
$scope.realm = realm;
|
||||||
$scope.user = angular.copy(user);
|
$scope.user = angular.copy(user);
|
||||||
|
$scope.temporaryPassword = true;
|
||||||
|
|
||||||
$scope.isTotp = false;
|
$scope.isTotp = false;
|
||||||
if(!!user.totp){
|
if(!!user.totp){
|
||||||
$scope.isTotp = user.totp;
|
$scope.isTotp = user.totp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.resetPassword = function(temporary) {
|
$scope.resetPassword = function() {
|
||||||
if ($scope.pwdChange) {
|
if ($scope.pwdChange) {
|
||||||
if ($scope.password != $scope.confirmPassword) {
|
if ($scope.password != $scope.confirmPassword) {
|
||||||
Notifications.error("Password and confirmation does not match.");
|
Notifications.error("Password and confirmation does not match.");
|
||||||
|
@ -281,13 +282,9 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use
|
||||||
|
|
||||||
var msgTitle = 'Change password';
|
var msgTitle = 'Change password';
|
||||||
var msg = 'Are you sure you want to change the users 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() {
|
Dialog.confirm(msgTitle, msg, function() {
|
||||||
UserCredentials.resetPassword({ realm: realm.realm, userId: user.username }, { type : "password", value : $scope.password, temporary: temporary }, function() {
|
UserCredentials.resetPassword({ realm: realm.realm, userId: user.username }, { type : "password", value : $scope.password, temporary: $scope.temporaryPassword }, function() {
|
||||||
Notifications.success("The password has been reset");
|
Notifications.success("The password has been reset");
|
||||||
$scope.password = null;
|
$scope.password = null;
|
||||||
$scope.confirmPassword = null;
|
$scope.confirmPassword = null;
|
||||||
|
|
|
@ -18,17 +18,36 @@
|
||||||
|
|
||||||
<form class="form-horizontal" name="userForm" novalidate>
|
<form class="form-horizontal" name="userForm" novalidate>
|
||||||
<fieldset class="border-top">
|
<fieldset class="border-top">
|
||||||
<legend><span class="text">Credential Management</span></legend>
|
<legend><span class="text">Reset Password</span></legend>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="password">Reset password</label>
|
<label class="col-sm-2 control-label" for="password">New password <span class="required" data-ng-show="create">*</span></label>
|
||||||
<div class="col-sm-6 kc-multiline">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" type="password" id="password" name="password" data-ng-model="password" placeholder="New password" required>
|
<input class="form-control" type="password" id="password" name="password" data-ng-model="password" required>
|
||||||
<input class="form-control" type="password" id="confirmPassword" name="confirmPassword" data-ng-model="confirmPassword" placeholder="Password confirmation" required>
|
|
||||||
<button class="btn btn-danger" type="submit" data-ng-click="resetPassword(true)" data-ng-show="password" tooltip="Temporary reset of password. User will be asked to change it when they log in." tooltip-placement="left">Reset Password</button>
|
|
||||||
<button class="btn btn-danger" type="submit" data-ng-click="resetPassword(false)" data-ng-show="password" tooltip="Change the password of the user." tooltip-placement="right">Change Password</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 control-label" for="confirmPassword">Password confirmation <span class="required" data-ng-show="create">*</span></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input class="form-control" type="password" id="confirmPassword" name="confirmPassword" data-ng-model="confirmPassword" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group clearfix block">
|
||||||
|
<label class="col-sm-2 control-label" for="temporaryPassword">Temporary</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input ng-model="temporaryPassword" name="temporaryPassword" id="temporaryPassword" onoffswitch />
|
||||||
|
</div>
|
||||||
|
<span tooltip-placement="right" tooltip="If enabled user is required to change password on next login" class="fa fa-info-circle"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pull-right form-actions" data-ng-show="password && confirmPassword">
|
||||||
|
<button class="btn btn-danger" type="submit" data-ng-click="resetPassword(true)">Reset Password</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="border-top" data-ng-show="user.email || user.totp">
|
||||||
<div class="form-group" data-ng-show="user.email">
|
<div class="form-group" data-ng-show="user.email">
|
||||||
<label class="col-sm-2 control-label" for="password">Reset password email</label>
|
<label class="col-sm-2 control-label" for="password">Reset password email</label>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
|
@ -37,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" data-ng-show="user.totp">
|
<div class="form-group" data-ng-show="user.totp">
|
||||||
<label class="col-sm-2 control-label" for="password">Remove totp</label>
|
<label class="col-sm-2 control-label">Remove totp</label>
|
||||||
<div class="col-sm-5" data-ng-show="user.totp">
|
<div class="col-sm-5" data-ng-show="user.totp">
|
||||||
<button class="btn btn-danger" type="submit" data-ng-click="removeTotp()" tooltip="Remove one time password generator for user." tooltip-placement="right">Remove TOTP</button>
|
<button class="btn btn-danger" type="submit" data-ng-click="removeTotp()" tooltip="Remove one time password generator for user." tooltip-placement="right">Remove TOTP</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue