Option to generate multiple new passwords (closes #2350)
This commit is contained in:
parent
2753af3585
commit
42f723f3cb
@ -415,11 +415,13 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
.controller('UserListCtrl', [
|
.controller('UserListCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
|
'$http',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
'UserForm',
|
'UserForm',
|
||||||
'User',
|
'User',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, $state, ngDialog, UserForm, User, Group) {
|
'PasswordGenerator',
|
||||||
|
function($scope, $state, $http, ngDialog, UserForm, User, Group, PasswordGenerator) {
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Group.bindAll({where: {id: {'>': 1}}}, $scope, 'groups');
|
Group.bindAll({where: {id: {'>': 1}}}, $scope, 'groups');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
@ -520,6 +522,22 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
$scope.isSelectMode = false;
|
$scope.isSelectMode = false;
|
||||||
$scope.uncheckAll();
|
$scope.uncheckAll();
|
||||||
};
|
};
|
||||||
|
// generate new passwords
|
||||||
|
$scope.generateNewPasswordsMultiple = function () {
|
||||||
|
angular.forEach($scope.users, function (user) {
|
||||||
|
if (user.selected) {
|
||||||
|
var newPassword = PasswordGenerator.generate();
|
||||||
|
user.default_password = newPassword;
|
||||||
|
User.save(user);
|
||||||
|
$http.post(
|
||||||
|
'/rest/users/user/' + user.id + '/reset_password/',
|
||||||
|
{'password': newPassword}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$scope.isSelectMode = false;
|
||||||
|
$scope.uncheckAll();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
<option value="delete" translate>Delete</option>
|
<option value="delete" translate>Delete</option>
|
||||||
<option value="addGroup" translate>Add group</option>
|
<option value="addGroup" translate>Add group</option>
|
||||||
<option value="removeGroup" translate>Remove group</option>
|
<option value="removeGroup" translate>Remove group</option>
|
||||||
|
<option value="generatePasswords" translate>Generate new passwords</option>
|
||||||
</select>
|
</select>
|
||||||
<!-- delete button -->
|
<!-- delete button -->
|
||||||
<a ng-show="selectedAction == 'delete'"
|
<a ng-show="selectedAction == 'delete'"
|
||||||
@ -113,6 +114,12 @@
|
|||||||
<i class="fa fa-minus fa-lg"></i>
|
<i class="fa fa-minus fa-lg"></i>
|
||||||
<translate>Remove group</translate>
|
<translate>Remove group</translate>
|
||||||
</a>
|
</a>
|
||||||
|
<!-- generate new password button -->
|
||||||
|
<a ng-show="selectedAction == 'generatePasswords'" class="btn btn-default"
|
||||||
|
ng-click="generateNewPasswordsMultiple()">
|
||||||
|
<i class="fa fa-magic"></i>
|
||||||
|
<translate>Generate new passwords</translate>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user