DEV: Show confirmation dialog when admins disable 2FA (#29652)

This PR ensures that admins are shown a confirmation dialog when clicking to disable 2FA for a user. The 2FA button is right below the "Grant Badge" button and as such it can easily be clicked accidentally. It's also good practice to ask for confirmation before removing important functionality.
This commit is contained in:
Keegan George
2024-11-08 09:39:42 +09:00
committed by GitHub
parent fc5c0270f7
commit 5a23a74bbc
4 changed files with 46 additions and 6 deletions

View File

@ -374,7 +374,12 @@ export default class AdminUserIndexController extends Controller.extend(
@action
disableSecondFactor() {
return this.model.disableSecondFactor();
this.dialog.yesNoConfirm({
message: I18n.t("admin.user.disable_second_factor_confirm"),
didConfirm: () => {
return this.model.disableSecondFactor();
},
});
}
@action