Skip to content

Commit da8225a

Browse files
authored
Merge pull request dani-garcia#3282 from JCBird1012/main
Add confirmation for removing 2FA and deauthing sessions in admin panel
2 parents af6d17b + 8f8d741 commit da8225a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/static/scripts/admin_users.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ function remove2fa(event) {
3232
alert("Required parameters not found!");
3333
return false;
3434
}
35-
_post(`${BASE_URL}/admin/users/${id}/remove-2fa`,
36-
"2FA removed correctly",
37-
"Error removing 2FA"
38-
);
35+
const confirmed = confirm(`Are you sure you want to remove 2FA for "${email}"?`);
36+
if (confirmed) {
37+
_post(`${BASE_URL}/admin/users/${id}/remove-2fa`,
38+
"2FA removed correctly",
39+
"Error removing 2FA"
40+
);
41+
}
3942
}
4043

4144
function deauthUser(event) {
@@ -46,10 +49,13 @@ function deauthUser(event) {
4649
alert("Required parameters not found!");
4750
return false;
4851
}
49-
_post(`${BASE_URL}/admin/users/${id}/deauth`,
50-
"Sessions deauthorized correctly",
51-
"Error deauthorizing sessions"
52-
);
52+
const confirmed = confirm(`Are you sure you want to deauthorize sessions for "${email}"?`);
53+
if (confirmed) {
54+
_post(`${BASE_URL}/admin/users/${id}/deauth`,
55+
"Sessions deauthorized correctly",
56+
"Error deauthorizing sessions"
57+
);
58+
}
5359
}
5460

5561
function disableUser(event) {

0 commit comments

Comments
 (0)