mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
30 lines
878 B
TypeScript
30 lines
878 B
TypeScript
import angular from 'angular';
|
|
import config from 'app/core/config';
|
|
|
|
export class ChangePasswordCtrl {
|
|
/** @ngInject */
|
|
constructor($scope, backendSrv, $location, navModelSrv) {
|
|
$scope.command = {};
|
|
$scope.authProxyEnabled = config.authProxyEnabled;
|
|
$scope.ldapEnabled = config.ldapEnabled;
|
|
$scope.navModel = navModelSrv.getNav('profile', 'change-password', 0);
|
|
|
|
$scope.changePassword = () => {
|
|
if (!$scope.userForm.$valid) {
|
|
return;
|
|
}
|
|
|
|
if ($scope.command.newPassword !== $scope.command.confirmNew) {
|
|
$scope.appEvent('alert-warning', ['New passwords do not match', '']);
|
|
return;
|
|
}
|
|
|
|
backendSrv.put('/api/user/password', $scope.command).then(() => {
|
|
$location.path('profile');
|
|
});
|
|
};
|
|
}
|
|
}
|
|
|
|
angular.module('grafana.controllers').controller('ChangePasswordCtrl', ChangePasswordCtrl);
|