mirror of
https://github.com/discourse/discourse.git
synced 2025-06-23 03:11:31 +08:00
FEATURE: Use second factor for admin confirmation (#14293)
Administrators can use second factor to confirm granting admin access without using email. The old method of confirmation via email is still used as a fallback when second factor is unavailable.
This commit is contained in:
@ -99,9 +99,20 @@ const AdminUser = User.extend({
|
||||
});
|
||||
},
|
||||
|
||||
grantAdmin() {
|
||||
grantAdmin(data) {
|
||||
return ajax(`/admin/users/${this.id}/grant_admin`, {
|
||||
type: "PUT",
|
||||
data,
|
||||
}).then((resp) => {
|
||||
if (resp.success && !resp.email_confirmation_required) {
|
||||
this.setProperties({
|
||||
admin: true,
|
||||
can_grant_admin: false,
|
||||
can_revoke_admin: true,
|
||||
});
|
||||
}
|
||||
|
||||
return resp;
|
||||
});
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user