Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pages/signin/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function LoginForm(props) {
* Check that all the form fields are valid, then trigger the submit callback
*/
const validateAndSubmitForm = useCallback(() => {
if (props.network.isOffline) {
if (props.network.isOffline || props.account.isLoading) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not perfect solution. There's still milliseconds between button 2nd trigger and props.account.isLoading being updated to true. Especially on slow mobile devices like android emulator.
More details: #32478 (comment)

return;
}

Expand Down Expand Up @@ -149,7 +149,7 @@ function LoginForm(props) {

// Check if this login has an account associated with it or not
Session.beginSignIn(parsedPhoneNumber.possible ? parsedPhoneNumber.number.e164 : loginTrim);
}, [login, props.closeAccount, props.network, setFormError]);
}, [login, props.account, props.closeAccount, props.network, setFormError]);

useEffect(() => {
// Just call clearAccountMessages on the login page (home route), because when the user is in the transition route and not yet authenticated,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ function BaseValidateCodeForm(props) {
* Check that all the form fields are valid, then trigger the submit callback
*/
const validateAndSubmitForm = useCallback(() => {
if (props.account.isLoading) {
return;
}
const requiresTwoFactorAuth = props.account.requiresTwoFactorAuth;
if (requiresTwoFactorAuth) {
if (input2FARef.current) {
Expand Down Expand Up @@ -228,7 +231,7 @@ function BaseValidateCodeForm(props) {
} else {
Session.signIn(validateCode, twoFactorAuthCode, props.preferredLocale);
}
}, [props.account.requiresTwoFactorAuth, props.credentials, props.preferredLocale, twoFactorAuthCode, validateCode]);
}, [props.account, props.credentials, props.preferredLocale, twoFactorAuthCode, validateCode]);

return (
<>
Expand Down