mirror of https://github.com/zulip/zulip.git
social auth: Validate email in backends without get_verified_emails.
If the social backend doesn't have get_verified_emails emails, and we simply grab kwargs["details"].get("email") for the email, we should still validate it is correct. Needed for SAML. This will get covered by tests in upcoming commits that add SAML support.
This commit is contained in:
parent
7171a0a842
commit
82f923c27a
|
@ -725,8 +725,12 @@ def social_associate_user_helper(backend: BaseAuth, return_data: Dict[str, Any],
|
|||
return None
|
||||
|
||||
validated_email = chosen_email
|
||||
else: # nocoverage
|
||||
# This code path isn't used by GitHubAuthBackend
|
||||
else:
|
||||
try:
|
||||
validate_email(kwargs["details"].get("email"))
|
||||
except ValidationError:
|
||||
return_data['invalid_email'] = True
|
||||
return None
|
||||
validated_email = kwargs["details"].get("email")
|
||||
|
||||
if not validated_email: # nocoverage
|
||||
|
|
Loading…
Reference in New Issue