Add SSO and device management samples
This commit is contained in:
@@ -1468,6 +1468,23 @@
|
||||
Fido2Login.prototype._getWebAuthnErrorMessage = function(error) {
|
||||
if (!error) return this.i18n.getText('msg_fido2_failed');
|
||||
|
||||
// Check for browser-native WebAuthn errors with URL references
|
||||
const errorMessage = error.message || '';
|
||||
if (errorMessage.includes('https://www.w3.org/TR/webauthn')) {
|
||||
// Check for common browser-native error patterns
|
||||
if (error.name === 'NotAllowedError' || errorMessage.toLowerCase().includes('not allowed')) {
|
||||
return this.i18n.getText('error_not_allowed');
|
||||
}
|
||||
if (errorMessage.toLowerCase().includes('timeout') || errorMessage.toLowerCase().includes('timed out')) {
|
||||
return this.i18n.getText('error_timeout');
|
||||
}
|
||||
if (errorMessage.toLowerCase().includes('invalid state') || errorMessage.toLowerCase().includes('already registered')) {
|
||||
return this.i18n.getText('error_invalid_state');
|
||||
}
|
||||
// Default to not allowed for browser privacy errors
|
||||
return this.i18n.getText('error_not_allowed');
|
||||
}
|
||||
|
||||
const i18nKey = this._getWebAuthnErrorI18nKey(error);
|
||||
if (i18nKey && this.i18n.getText(i18nKey)) {
|
||||
return this.i18n.getText(i18nKey);
|
||||
@@ -2421,6 +2438,22 @@
|
||||
const errorMessage = error.message || '';
|
||||
const errorName = error.name || '';
|
||||
|
||||
// Check for browser-native WebAuthn errors with URL references
|
||||
if (errorMessage.includes('https://www.w3.org/TR/webauthn')) {
|
||||
// Check for common browser-native error patterns
|
||||
if (errorName === 'NotAllowedError' || errorMessage.toLowerCase().includes('not allowed')) {
|
||||
return this.i18n.getText('error_not_allowed');
|
||||
}
|
||||
if (errorMessage.toLowerCase().includes('timeout') || errorMessage.toLowerCase().includes('timed out')) {
|
||||
return this.i18n.getText('error_timeout');
|
||||
}
|
||||
if (errorMessage.toLowerCase().includes('invalid state') || errorMessage.toLowerCase().includes('already registered')) {
|
||||
return this.i18n.getText('error_invalid_state');
|
||||
}
|
||||
// Default to not allowed for browser privacy errors
|
||||
return this.i18n.getText('error_not_allowed');
|
||||
}
|
||||
|
||||
// Check WebAuthn DOM error name first
|
||||
if (errorName && this._getWebAuthnErrorI18nKey) {
|
||||
const i18nKey = this._getWebAuthnErrorI18nKey(error);
|
||||
|
||||
Reference in New Issue
Block a user