-
Notifications
You must be signed in to change notification settings - Fork 14
fix: login flow properly shows invalid email #7802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
0e72ef9
7159cad
17eab1a
992f79c
a01810d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
|
|
||
| namespace DCL.AuthenticationScreenFlow | ||
| { | ||
| public class LoginSelectionAuthState : AuthStateBase, IState, IPayloadedState<PopupType>, IPayloadedState<int> | ||
| public class LoginSelectionAuthState : AuthStateBase, IState, IPayloadedState<ErrorType>, IPayloadedState<int> | ||
| { | ||
| private const string REQUEST_BETA_ACCESS_LINK = "https://68zbqa0m12c.typeform.com/to/y9fZeNWm"; | ||
|
|
||
|
|
@@ -40,6 +40,8 @@ public LoginSelectionAuthState(MVCStateMachine<AuthStateBase> machine, | |
| this.webBrowser = webBrowser; | ||
| this.enableEmailOTP = enableEmailOTP; | ||
|
|
||
| compositeWeb3Provider.OTPSendSuccess += OnOTPSendSuccess; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this subscription and move related login inside so you will re-use same |
||
|
|
||
| // Cancel button persists in the Verification state (until code is shown) | ||
| view.CancelLoginButton.onClick.AddListener(OnCancelBeforeVerification); | ||
| } | ||
|
|
@@ -50,6 +52,7 @@ public LoginSelectionAuthState(MVCStateMachine<AuthStateBase> machine, | |
| currentState.Value = AuthStatus.LoginSelectionScreen; | ||
|
|
||
| view.SetLoadingSpinnerVisibility(false); | ||
| view.SetEmailInputFieldSpinnerActive(false); | ||
|
|
||
| if (view.gameObject.activeSelf) | ||
| { | ||
|
|
@@ -109,18 +112,22 @@ public override void Exit() | |
| base.Exit(); | ||
| } | ||
|
|
||
| public void Enter(PopupType popupType) | ||
| public void Enter(ErrorType errorType) | ||
| { | ||
| switch (popupType) | ||
| switch (errorType) | ||
| { | ||
| case PopupType.NONE: break; | ||
| case PopupType.CONNECTION_ERROR: | ||
| case ErrorType.NONE: break; | ||
| case ErrorType.CONNECTION_ERROR: | ||
| view.ErrorPopupRoot.SetActive(true); | ||
| break; | ||
| case PopupType.RESTRICTED_USER: | ||
| case ErrorType.RESTRICTED_USER: | ||
| view.RestrictedUserContainer.SetActive(true); | ||
| break; | ||
| default: throw new ArgumentOutOfRangeException(nameof(popupType), popupType, null); | ||
| case ErrorType.INVALID_EMAIL: | ||
| view.SetEmailInputFieldErrorState(true); | ||
| Enter(); | ||
| return; | ||
| default: throw new ArgumentOutOfRangeException(nameof(errorType), errorType, null); | ||
| } | ||
|
|
||
| Enter(UIAnimationHashes.SLIDE); | ||
|
|
@@ -178,10 +185,16 @@ private void OTPLogin() | |
|
|
||
| controller.CurrentLoginMethod = LoginMethod.EMAIL_OTP; | ||
| currentState.Value = AuthStatus.LoginRequested; | ||
| view.SetEmailInputFieldSpinnerActive(true); | ||
|
|
||
| view.Hide(); | ||
| machine.Enter<IdentityVerificationOTPAuthState, (string, CancellationToken)>( | ||
| payload: (viewInstance.LoginSelectionAuthView.EmailInputField.Text, controller.GetRestartedLoginToken())); | ||
| payload: (view.EmailInputField.Text, controller.GetRestartedLoginToken())); | ||
| } | ||
|
|
||
| private void OnOTPSendSuccess(string _) | ||
| { | ||
| view.SetEmailInputFieldSpinnerActive(false); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this inside the view logic (inside its |
||
| view.Hide(); | ||
| } | ||
|
|
||
| private void OnRetryFromError() | ||
|
|
@@ -203,10 +216,11 @@ private void RequestAlphaAccess() => | |
| webBrowser.OpenUrl(REQUEST_BETA_ACCESS_LINK); | ||
| } | ||
|
|
||
| public enum PopupType | ||
| public enum ErrorType | ||
| { | ||
| NONE = 0, | ||
| CONNECTION_ERROR = 1, | ||
| RESTRICTED_USER = 2, | ||
| INVALID_EMAIL = 3, | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect
to be also here, so we see all switching logic in one place and understand how transition happens