Reset default password of an user in UserUpdateCtrl. (Fixes #412)

This commit is contained in:
Emanuel Schuetze 2015-11-18 09:50:49 +01:00
parent 07bd763a63
commit e9cf2fb591
2 changed files with 22 additions and 2 deletions

View File

@ -388,10 +388,11 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
.controller('UserUpdateCtrl', [
'$scope',
'$state',
'$http',
'User',
'user',
'Group',
function($scope, $state, User, user, Group) {
function($scope, $state, $http, User, user, Group) {
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
$scope.user = user; // autoupdate is not activated
$scope.save = function (user) {
@ -404,6 +405,17 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
}
);
};
$scope.reset_password = function (user) {
$http.post('/rest/users/user/2/reset_password/', {})
.then(
function(data) {
// TODO: Success message
},
function(data) {
// TODO: error message
}
);
}
}
])

View File

@ -44,7 +44,15 @@
<div class="form-group row">
<div class="col-xs-6">
<label for="inputDefaultPassword" translate>Default password</label>
<div class="input-group">
<input type="text" ng-model="user.default_password" class="form-control" name="inputDefaultPassword">
<span class="input-group-btn">
<button ng-click="reset_password(user)" class="btn btn-default">
<i class="fa fa-undo"></i>
<translate>Reset</translate>
</button>
</span>
</div>
</div>
</div>
<div class="form-group">