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:
Bianca Nenciu
2021-09-14 15:19:28 +03:00
committed by GitHub
parent f517b6997c
commit 6a7ea66670
9 changed files with 253 additions and 6 deletions

View File

@ -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;
});
},