mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-11-03 02:47:18 +00:00
ui: u2f: refactor error code map out and use in login window
to avoid showing numbers as error codes to users, even though the strings are not much more helpful either... Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
35e8d081ec
commit
2d41c7e6f2
@ -808,6 +808,17 @@ Ext.define('PVE.Utils', { utilities: {
|
||||
return Ext.htmlEncode(first + " " + last);
|
||||
},
|
||||
|
||||
render_u2f_error: function(error) {
|
||||
var ErrorNames = {
|
||||
'1': gettext('Other Error'),
|
||||
'2': gettext('Bad Request'),
|
||||
'3': gettext('Configuration Unsupported'),
|
||||
'4': gettext('Device Ineligible'),
|
||||
'5': gettext('Timeout')
|
||||
};
|
||||
return "U2F Error: " + ErrorNames[error] || Proxmox.Utils.unknownText;
|
||||
},
|
||||
|
||||
windowHostname: function() {
|
||||
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
|
||||
function(m, addr, offset, original) { return addr; });
|
||||
|
||||
@ -40,16 +40,9 @@ Ext.define('PVE.window.TFAEdit', {
|
||||
},
|
||||
|
||||
showError: function(error) {
|
||||
var ErrorNames = {
|
||||
'1': gettext('Other Error'),
|
||||
'2': gettext('Bad Request'),
|
||||
'3': gettext('Configuration Unsupported'),
|
||||
'4': gettext('Device Ineligible'),
|
||||
'5': gettext('Timeout')
|
||||
};
|
||||
Ext.Msg.alert(
|
||||
gettext('Error'),
|
||||
"U2F Error: " + (ErrorNames[error] || Proxmox.Utils.unknownText)
|
||||
PVE.Utils.render_u2f_error(error)
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ Ext.define('PVE.window.LoginWindow', {
|
||||
msg.close();
|
||||
if (res.errorCode) {
|
||||
Proxmox.Utils.authClear();
|
||||
Ext.Msg.alert(gettext('Error'), "U2F Error: "+res.errorCode);
|
||||
Ext.Msg.alert(gettext('Error'), PVE.Utils.render_u2f_error(res.errorCode));
|
||||
return;
|
||||
}
|
||||
delete res.errorCode;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user