Merge resistanceisfutile into master

This commit is contained in:
Joseph Schorr 2015-03-23 15:39:08 -04:00
commit 85d6500daa
7 changed files with 91 additions and 3 deletions

View file

@ -122,12 +122,20 @@ def _validate_github_with_key(config_key, config):
if not github_config.get('CLIENT_SECRET'):
raise Exception('Missing Client Secret')
if github_config.get('ORG_RESTRICT') and not github_config.get('ALLOWED_ORGANIZATIONS'):
raise Exception('Organization restriction must have at least one allowed organization')
client = app.config['HTTPCLIENT']
oauth = GithubOAuthConfig(config, config_key)
result = oauth.validate_client_id_and_secret(client)
if not result:
raise Exception('Invalid client id or client secret')
if github_config.get('ALLOWED_ORGANIZATIONS'):
for org_id in github_config.get('ALLOWED_ORGANIZATIONS'):
if not oauth.validate_organization(org_id, client):
raise Exception('Invalid organization: %s' % org_id)
def _validate_google_login(config):
""" Validates the Google Login client ID and secret. """