ui: webauthn registration: adapt error messages
There are variuos hints that 'InvalidStateError' can be assumed to come from an already registered token[0][1]. So indicate that more strongly, also omit the extra line and warning triangle, there's already an error icon present. [0]: step 2: https://w3c.github.io/webauthn/#sctn-registering-a-new-credential [1]: step 3: https://w3c.github.io/webauthn/#sctn-op-make-cred Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
a8a0132766
commit
7f9eef1d47
@ -99,20 +99,12 @@ Ext.define('PBS.window.AddWebauthn', {
|
|||||||
try {
|
try {
|
||||||
token_response = await navigator.credentials.create(challenge_obj);
|
token_response = await navigator.credentials.create(challenge_obj);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let errmsg = `<i class="fa fa-warning warning"></i>
|
let errmsg = error.message;
|
||||||
${error.name}: ${error.message}`;
|
|
||||||
if (error.name === 'InvalidStateError') {
|
if (error.name === 'InvalidStateError') {
|
||||||
// probably a duplicate token
|
errmsg = gettext('Is this token already registered?');
|
||||||
throw `${gettext('There was an error during authenticator registration.')}
|
|
||||||
<br>
|
|
||||||
${gettext('This probably means that this authenticator is already registered.')}
|
|
||||||
<br><br>
|
|
||||||
${errmsg}`;
|
|
||||||
} else {
|
|
||||||
throw `${gettext('There was an error during token registration.')}
|
|
||||||
<br><br>
|
|
||||||
${errmsg}`;
|
|
||||||
}
|
}
|
||||||
|
throw gettext('An error occurred during token registration.') +
|
||||||
|
`<br>${error.name}: ${errmsg}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We cannot pass ArrayBuffers to the API, so extract & convert the data.
|
// We cannot pass ArrayBuffers to the API, so extract & convert the data.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user