diff --git a/zproject/backends.py b/zproject/backends.py index d4845ea5fb..3be70b7af3 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -229,10 +229,12 @@ class SocialAuthMixin(ZulipAuthMixin): is_signup = strategy.session_get('is_signup') == '1' subdomain = strategy.session_get('subdomain') - if not subdomain: + mobile_flow_otp = strategy.session_get('mobile_flow_otp') + if not subdomain or mobile_flow_otp is not None: return login_or_register_remote_user(request, email_address, user_profile, full_name, invalid_subdomain=bool(invalid_subdomain), + mobile_flow_otp=mobile_flow_otp, is_signup=is_signup) try: realm = Realm.objects.get(string_id=subdomain) diff --git a/zproject/settings.py b/zproject/settings.py index 167e5546eb..51553ebc31 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -1366,7 +1366,7 @@ else: # SOCIAL AUTHENTICATION SETTINGS ######################################################################## -SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ['subdomain', 'is_signup'] +SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ['subdomain', 'is_signup', 'mobile_flow_otp'] SOCIAL_AUTH_LOGIN_ERROR_URL = '/login/' SOCIAL_AUTH_GITHUB_SECRET = get_secret('social_auth_github_secret')