GitHub login fixes:

- Allow for case insensitivity in the org name list
  - Remove the check for verified email addresses when under Enterprise; it isn't supported there.
This commit is contained in:
Joseph Schorr 2015-04-16 12:17:39 -04:00
parent f8c80f7d11
commit 3cd11c8f45
2 changed files with 11 additions and 4 deletions

View file

@ -181,7 +181,7 @@ def github_oauth_callback():
get_orgs = client.get(github_login.orgs_endpoint(), params=token_param,
headers={'Accept': 'application/vnd.github.moondragon+json'})
organizations = set([org.get('login') for org in get_orgs.json()])
organizations = set([org.get('login').lower() for org in get_orgs.json()])
if not (organizations & set(github_login.allowed_organizations())):
err = """You are not a member of an allowed GitHub organization.
Please contact your system administrator if you believe this is in error."""
@ -193,7 +193,7 @@ def github_oauth_callback():
found_email = None
for user_email in get_email.json():
if not user_email['verified']:
if not github_login.is_enterprise() and not user_email['verified']:
continue
found_email = user_email['email']