Skip to content

Commit

Permalink
refactor: call extract_domain once
Browse files Browse the repository at this point in the history
  • Loading branch information
jawabuu committed May 13, 2021
1 parent 3f3034e commit 0f8a9f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions oidc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ def dispatch(self, request, helper):
return helper.error(ERR_INVALID_RESPONSE)

# support legacy style domains with pure domain regexp
user_domain = extract_domain(payload["email"])
if self.version is None:
domain = extract_domain(payload["email"])
domain = user_domain
else:
domain = payload.get("hd", extract_domain(payload["email"]))
domain = payload.get("hd", user_domain)

if domain is None:
return helper.error(ERR_INVALID_DOMAIN % (domain,))
Expand Down

0 comments on commit 0f8a9f4

Please sign in to comment.