Skip to content
Snippets Groups Projects
Verified Commit f6a77042 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: Enhance login functionality with additional event emissions

Summary of changes
- Added new event fires to enhance user feedback during the login process.
- Corrected terminology in the documentation for clarity.

- Introduced new event emissions:
  - "second-factor-success" is triggered upon successful second-factor authentication to signal any handlers waiting for this event.
  - "digits-success" fires once the digits button is successfully activated, allowing further actions to be taken.

- Updated the comments in the code to state "digit control" instead of "digits control," improving the grammatical accuracy of the documentation within `openDigits()` method.
parent 6296d1f3
Branches
Tags
No related merge requests found
...@@ -131,6 +131,9 @@ const digitsCollapseSymbol = Symbol("digitsCollapse"); ...@@ -131,6 +131,9 @@ const digitsCollapseSymbol = Symbol("digitsCollapse");
* *
* @fires login-success * @fires login-success
* @fires redirect-to-first-success-url * @fires redirect-to-first-success-url
* @fires second-factor-success
* @fires digits-success
* @fires monster-login-clicked
*/ */
class Login extends CustomElement { class Login extends CustomElement {
/** /**
...@@ -388,7 +391,7 @@ class Login extends CustomElement { ...@@ -388,7 +391,7 @@ class Login extends CustomElement {
} }
/** /**
* Opens the digits collapse and focuses the digits control. * Opens the digits collapse and focuses the digit control.
* @returns {Login} * @returns {Login}
*/ */
openDigits() { openDigits() {
...@@ -1455,6 +1458,7 @@ function initEventHandler() { ...@@ -1455,6 +1458,7 @@ function initEventHandler() {
if (response.ok) { if (response.ok) {
const timeout = this.getOption("timeoutForSuccess"); const timeout = this.getOption("timeoutForSuccess");
this[secondFactorButtonSymbol].setState("successful", timeout); this[secondFactorButtonSymbol].setState("successful", timeout);
fireEvent(this, "second-factor-success");
setTimeout(() => { setTimeout(() => {
this.openLoggedIn(); this.openLoggedIn();
}, timeout); }, timeout);
...@@ -1538,6 +1542,7 @@ function initEventHandler() { ...@@ -1538,6 +1542,7 @@ function initEventHandler() {
if (response.ok) { if (response.ok) {
this[digitsButtonSymbol].setState("successful", timeout); this[digitsButtonSymbol].setState("successful", timeout);
fireEvent(this, "digits-success");
setTimeout(() => { setTimeout(() => {
this.openLoggedIn(); this.openLoggedIn();
}, timeout); }, timeout);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment