From 85491b6c8f8e518a272dbfba5dfcba88995d5f80 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Mon, 21 Jan 2019 18:13:31 +0100 Subject: [PATCH] prevent accidental self-lockout in multiSelect --- .../users/components/user-list/user-list.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index a2ed21735..afabbc718 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -370,7 +370,14 @@ export class UserListComponent extends ListViewBaseComponent imp * Handler for bulk setting new passwords. Needs multiSelect mode. */ public async resetPasswordsSelected(): Promise { - 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); }