From 11426a2cec855b1424c636dee77ad9d36e43e7ec Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Wed, 10 May 2017 12:00:47 +0500 Subject: [PATCH] log_into_subdomain: User should be None in signup. --- zerver/views/auth.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zerver/views/auth.py b/zerver/views/auth.py index 5c6a16f716..eac72793e0 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -392,7 +392,13 @@ def log_into_subdomain(request): email_address = data['email'] full_name = data['name'] is_signup = data['is_signup'] - user_profile, return_data = authenticate_remote_user(request, email_address) + if is_signup: + # If we are signing up, user_profile should be None. In case + # email_address already exists, user will get an error message. + user_profile = None + return_data = {} # type: Dict[str, Any] + else: + user_profile, return_data = authenticate_remote_user(request, email_address) invalid_subdomain = bool(return_data.get('invalid_subdomain')) return login_or_register_remote_user(request, email_address, user_profile, full_name, invalid_subdomain=invalid_subdomain,