Merge pull request #4166 from MaximilianKrambach/adminResetWarning

prevent accidental self- lockout in multiSelect
This commit is contained in:
Maximilian Krambach 2019-03-26 11:42:47 +01:00 committed by GitHub
commit 5d51c798fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,7 +370,14 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser, User> imp
* Handler for bulk setting new passwords. Needs multiSelect mode.
*/
public async resetPasswordsSelected(): Promise<void> {
for (const user of this.selectedRows) {
if (this.selectedRows.find(row => row.user.id === this.operator.user.id)) {
this.raiseError(
this.translate.instant(
'Note: Your own password will not be changed. Please use the password change dialog instead.'
)
);
}
for (const user of this.selectedRows.filter(u => u.user.id !== this.operator.user.id)) {
const password = this.repo.getRandomPassword();
this.repo.resetPassword(user, password, true);
}