mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 04:51:09 +00:00
ui: user view: add 'Unlock TFA' button
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
2387c1946a
commit
5970607408
@ -93,6 +93,35 @@ Ext.define('PVE.dc.UserView', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let unlock_btn = new Proxmox.button.Button({
|
||||||
|
text: gettext('Unlock TFA'),
|
||||||
|
disabled: true,
|
||||||
|
selModel: sm,
|
||||||
|
enableFn: rec => !!(caps.access['User.Modify'] &&
|
||||||
|
(rec.data['totp-locked'] || rec.data['tfa-locked-until'])),
|
||||||
|
handler: function(btn, event, rec) {
|
||||||
|
Ext.Msg.confirm(
|
||||||
|
gettext(Ext.String.format('Unlock TFA authentication for {0}', rec.data.userid)),
|
||||||
|
gettext("Locked 2nd factors can happen if the user's password was leaked. Are you sure you want to unlock the user?"),
|
||||||
|
function(btn_response) {
|
||||||
|
if (btn_response === 'yes') {
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: `/access/users/${rec.data.userid}/unlock-tfa`,
|
||||||
|
waitMsgTarget: me,
|
||||||
|
method: 'PUT',
|
||||||
|
failure: function(response, options) {
|
||||||
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||||
|
},
|
||||||
|
success: function(response, options) {
|
||||||
|
reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
Ext.apply(me, {
|
Ext.apply(me, {
|
||||||
store: store,
|
store: store,
|
||||||
selModel: sm,
|
selModel: sm,
|
||||||
@ -116,6 +145,8 @@ Ext.define('PVE.dc.UserView', {
|
|||||||
pwchange_btn,
|
pwchange_btn,
|
||||||
'-',
|
'-',
|
||||||
perm_btn,
|
perm_btn,
|
||||||
|
'-',
|
||||||
|
unlock_btn,
|
||||||
],
|
],
|
||||||
viewConfig: {
|
viewConfig: {
|
||||||
trackOver: false,
|
trackOver: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user