Merge pull request #1690 from emanuelschuetze/rest-password

Reset default password of an user in UserUpdateCtrl. (Fixes #412)
This commit is contained in:
Oskar Hahn 2015-11-20 10:26:04 +01:00
commit 02a67097e4
2 changed files with 22 additions and 2 deletions

View File

@ -390,10 +390,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) {
@ -406,6 +407,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>
<input type="text" ng-model="user.default_password" class="form-control" name="inputDefaultPassword">
<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">