fix(userSettings): allow to change admin password when using LDAP auth (#1227)

pull/1228/head
Anthony Lapenna 2017-09-22 08:00:13 +02:00 committed by GitHub
parent 6bf7c90634
commit 7b924bde83
2 changed files with 4 additions and 4 deletions

View File

@ -59,8 +59,8 @@
<!-- !confirm-password-input -->
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-primary btn-sm" ng-disabled="AuthenticationMethod !== 1 || !formValues.currentPassword || formValues.newPassword.length < 8 || formValues.newPassword !== formValues.confirmPassword" ng-click="updatePassword()">Update password</button>
<span class="text-muted small" style="margin-left: 5px;" ng-if="AuthenticationMethod === 2">
<button type="submit" class="btn btn-primary btn-sm" ng-disabled="(AuthenticationMethod !== 1 && userID !== 1) || !formValues.currentPassword || formValues.newPassword.length < 8 || formValues.newPassword !== formValues.confirmPassword" ng-click="updatePassword()">Update password</button>
<span class="text-muted small" style="margin-left: 5px;" ng-if="AuthenticationMethod === 2 && userID !== 1">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
You cannot change your password when using LDAP authentication.
</span>

View File

@ -9,11 +9,10 @@ function ($scope, $state, $sanitize, Authentication, UserService, Notifications,
$scope.updatePassword = function() {
$scope.invalidPassword = false;
var userID = Authentication.getUserDetails().ID;
var currentPassword = $sanitize($scope.formValues.currentPassword);
var newPassword = $sanitize($scope.formValues.newPassword);
UserService.updateUserPassword(userID, currentPassword, newPassword)
UserService.updateUserPassword($scope.userID, currentPassword, newPassword)
.then(function success() {
Notifications.success('Success', 'Password successfully updated');
$state.reload();
@ -28,6 +27,7 @@ function ($scope, $state, $sanitize, Authentication, UserService, Notifications,
};
function initView() {
$scope.userID = Authentication.getUserDetails().ID;
SettingsService.publicSettings()
.then(function success(data) {
$scope.AuthenticationMethod = data.AuthenticationMethod;