diff --git a/src/Umbraco.Cms.Api.Management/Security/TwoFactorLoginViewOptions.cs b/src/Umbraco.Cms.Api.Management/Security/TwoFactorLoginViewOptions.cs index 44cc9db3a7..d045797f10 100644 --- a/src/Umbraco.Cms.Api.Management/Security/TwoFactorLoginViewOptions.cs +++ b/src/Umbraco.Cms.Api.Management/Security/TwoFactorLoginViewOptions.cs @@ -8,5 +8,6 @@ public class TwoFactorLoginViewOptions /// /// Gets or sets the path of the view to show when setting up this 2fa provider /// + [Obsolete("Register the view in the backoffice instead. This will be removed in version 15.")] public string? SetupViewPath { get; set; } } diff --git a/src/Umbraco.Web.UI.Login/src/components/pages/login.page.element.ts b/src/Umbraco.Web.UI.Login/src/components/pages/login.page.element.ts index 234dbad9fd..55d10ebf8f 100644 --- a/src/Umbraco.Web.UI.Login/src/components/pages/login.page.element.ts +++ b/src/Umbraco.Web.UI.Login/src/components/pages/login.page.element.ts @@ -42,6 +42,12 @@ export default class UmbLoginPageElement extends UmbLitElement { if (!this.#formElement) return; + // We need to listen for the enter key to submit the form, because the uui-button does not support the native input fields submit event + this.#formElement.addEventListener('keypress', (e) => { + if (e.key === 'Enter') { + this.#onSubmitClick(); + } + }); this.#formElement.onsubmit = this.#handleSubmit; } @@ -91,7 +97,6 @@ export default class UmbLoginPageElement extends UmbLitElement { } if (response.error) { - this.dispatchEvent(new CustomEvent('umb-login-failed', {bubbles: true, composed: true})); return; } @@ -100,8 +105,6 @@ export default class UmbLoginPageElement extends UmbLitElement { if (returnPath) { location.href = returnPath; } - - this.dispatchEvent(new CustomEvent('umb-login-success', {bubbles: true, composed: true, detail: response.data})); }; get #greetingLocalizationKey() { diff --git a/src/Umbraco.Web.UI.Login/src/components/pages/mfa.page.element.ts b/src/Umbraco.Web.UI.Login/src/components/pages/mfa.page.element.ts index e047f7868f..5d54567fbb 100644 --- a/src/Umbraco.Web.UI.Login/src/components/pages/mfa.page.element.ts +++ b/src/Umbraco.Web.UI.Login/src/components/pages/mfa.page.element.ts @@ -56,6 +56,7 @@ export default class UmbMfaPageElement extends UmbLitElement { if (codeInput) { codeInput.error = false; codeInput.errorMessage = ''; + codeInput.setCustomValidity(''); } if (!form.checkValidity()) return; @@ -84,44 +85,30 @@ export default class UmbMfaPageElement extends UmbLitElement { this.buttonState = 'waiting'; - try { - const response = await this.#authContext.validateMfaCode(code, provider); - if (response.error) { - if (codeInput) { - codeInput.error = true; - codeInput.errorMessage = response.error; - } else { - this.error = response.error; - } - this.buttonState = 'failed'; - return; - } - - this.buttonState = 'success'; - - const returnPath = this.#authContext.returnPath; - if (returnPath) { - location.href = returnPath; - } - - this.dispatchEvent( - new CustomEvent('umb-login-success', {bubbles: true, composed: true}) - ); - } catch (e) { - if (e instanceof Error) { - this.error = e.message ?? 'Unknown error'; + const response = await this.#authContext.validateMfaCode(code, provider); + if (response.error) { + if (codeInput) { + codeInput.error = true; + codeInput.errorMessage = response.error; } else { - this.error = 'Unknown error'; + this.error = response.error; } this.buttonState = 'failed'; - this.dispatchEvent(new CustomEvent('umb-login-failed', {bubbles: true, composed: true})); + return; + } + + this.buttonState = 'success'; + + const returnPath = this.#authContext.returnPath; + if (returnPath) { + location.href = returnPath; } } protected renderDefaultView() { return html` -
+