mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-09 22:51:22 +00:00
GUAC-801 Implemented new endpoint for password update, and updated js to use the new endpoint.
This commit is contained in:
@@ -74,15 +74,15 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
$scope.password = null;
|
||||
$scope.newPassword = null;
|
||||
|
||||
/**
|
||||
* The password match for the user. The update password action will fail if
|
||||
* $scope.password !== $scope.passwordMatch.
|
||||
* $scope.newPassword !== $scope.passwordMatch.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
$scope.passwordMatch = null;
|
||||
$scope.newPasswordMatch = null;
|
||||
|
||||
/**
|
||||
* Returns whether critical data has completed being loaded.
|
||||
@@ -176,8 +176,9 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
|
||||
$scope.closePasswordUpdate = function closePasswordUpdate() {
|
||||
|
||||
// Clear the password fields and close the dialog
|
||||
$scope.password = null;
|
||||
$scope.passwordMatch = null;
|
||||
$scope.oldPassword = null;
|
||||
$scope.newPassword = null;
|
||||
$scope.newPasswordMatch = null;
|
||||
$scope.showPasswordDialog = false;
|
||||
};
|
||||
|
||||
@@ -188,29 +189,40 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
|
||||
$scope.updatePassword = function updatePassword() {
|
||||
|
||||
// Verify passwords match
|
||||
if ($scope.passwordMatch !== $scope.password) {
|
||||
if ($scope.newPasswordMatch !== $scope.newPassword) {
|
||||
$scope.showStatus({
|
||||
'className' : 'error',
|
||||
'title' : 'HOME.DIALOG_HEADER_ERROR',
|
||||
'text' : 'HOME.ERROR_PASSWORD_MISMATCH',
|
||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
||||
className : 'error',
|
||||
title : 'HOME.DIALOG_HEADER_ERROR',
|
||||
text : 'HOME.ERROR_PASSWORD_MISMATCH',
|
||||
actions : [ ACKNOWLEDGE_ACTION ]
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the user with the new password
|
||||
userService.saveUser({
|
||||
username: currentUserID,
|
||||
password: $scope.password
|
||||
userService.updateUserPassword(currentUserID, $scope.oldPassword, $scope.newPassword)
|
||||
.success(function passwordUpdated() {
|
||||
|
||||
// Close the password update dialog
|
||||
$scope.closePasswordUpdate();
|
||||
|
||||
// Indicate that the password has been changed
|
||||
$scope.showStatus({
|
||||
text : 'HOME.PASSWORD_CHANGED',
|
||||
actions : [ ACKNOWLEDGE_ACTION ]
|
||||
});
|
||||
})
|
||||
|
||||
// Notify of any errors
|
||||
.error(function passwordUpdateFailed(error) {
|
||||
$scope.showStatus({
|
||||
className : 'error',
|
||||
title : 'HOME.DIALOG_HEADER_ERROR',
|
||||
'text' : error.message,
|
||||
actions : [ ACKNOWLEDGE_ACTION ]
|
||||
});
|
||||
});
|
||||
|
||||
$scope.closePasswordUpdate();
|
||||
|
||||
// Indicate that the password has been changed
|
||||
$scope.showStatus({
|
||||
'text' : 'HOME.PASSWORD_CHANGED',
|
||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
||||
});
|
||||
};
|
||||
|
||||
}]);
|
||||
|
@@ -31,14 +31,16 @@
|
||||
<div class="section">
|
||||
<table class="properties">
|
||||
<tr>
|
||||
<th>{{'HOME.FIELD_HEADER_PASSWORD' | translate}}</th>
|
||||
|
||||
<td><input ng-model="password" type="password" /></td>
|
||||
<th>{{'HOME.FIELD_HEADER_PASSWORD_OLD' | translate}}</th>
|
||||
<td><input ng-model="oldPassword" type="password" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{'HOME.FIELD_HEADER_PASSWORD_AGAIN' | translate}}</th>
|
||||
|
||||
<td><input ng-model="passwordMatch" type="password" /></td>
|
||||
<th>{{'HOME.FIELD_HEADER_PASSWORD_NEW' | translate}}</th>
|
||||
<td><input ng-model="newPassword" type="password" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{'HOME.FIELD_HEADER_PASSWORD_NEW_AGAIN' | translate}}</th>
|
||||
<td><input ng-model="newPasswordMatch" type="password" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user