From 7e8e6992f42d1e5d26bd92727c9a77e2569b58f1 Mon Sep 17 00:00:00 2001 From: Topher Johnson Date: Tue, 20 Feb 2024 23:55:59 -0800 Subject: [PATCH] Remove reset password option for admin users Because admin users shouldn't be able to reset their own password without entering their password first, this commit removes the "reset password" option for admin users. Currently, hitting the reset password option as an admin will result in a 400 Bad request saying "Admin user passwords must not be empty (Parameter 'newPassword')" --- src/components/dashboard/users/UserPasswordForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/dashboard/users/UserPasswordForm.tsx b/src/components/dashboard/users/UserPasswordForm.tsx index 3f0d70967d..b1d2f531d4 100644 --- a/src/components/dashboard/users/UserPasswordForm.tsx +++ b/src/components/dashboard/users/UserPasswordForm.tsx @@ -33,7 +33,9 @@ const UserPasswordForm: FunctionComponent = ({ userId }: IProps) => { LibraryMenu.setTitle(user.Name); if (user.HasConfiguredPassword) { - (page.querySelector('#btnResetPassword') as HTMLDivElement).classList.remove('hide'); + if (!user.Policy?.IsAdministrator) { + (page.querySelector('#btnResetPassword') as HTMLDivElement).classList.remove('hide'); + } (page.querySelector('#fldCurrentPassword') as HTMLDivElement).classList.remove('hide'); } else { (page.querySelector('#btnResetPassword') as HTMLDivElement).classList.add('hide');