mirror of https://github.com/portainer/portainer
fix(userSettings): allow to change admin password when using LDAP auth (#1227)
parent
6bf7c90634
commit
7b924bde83
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue