tfa gui: fix adding recovery keys as user

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-12-10 13:43:09 +01:00
parent 30fb19be35
commit 5c48d0af1f

View File

@ -81,13 +81,19 @@ Ext.define('PBS.window.AddTfaRecovery', {
throw "no userid set";
}
let params = { type: 'recovery' };
if (Proxmox.UserName !== 'root@pam') {
params.password = me.lookup('password').getValue();
}
me.getView().close();
try {
let response = await PBS.Async.api2({
url: `${baseurl}/${userid}`,
method: 'POST',
params: { type: 'recovery' },
params,
});
let values = response.result.data.recovery.join("\n");
Ext.create('PBS.window.TfaRecoveryShow', {