From: tschmidt Date: Tue, 17 Jan 2012 01:58:29 +0000 (-0800) Subject: fixed WHITE_LISTED_DOMAINS default setting and exception handling X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e3f1b7b396ef38fc97df70bd559692f87e3de6cd;p=django-social-auth.git fixed WHITE_LISTED_DOMAINS default setting and exception handling --- diff --git a/social_auth/backends/google.py b/social_auth/backends/google.py index a29ca54..b81acc7 100644 --- a/social_auth/backends/google.py +++ b/social_auth/backends/google.py @@ -47,7 +47,7 @@ GOOGLE_OPENID_URL = 'https://www.google.com/accounts/o8/id' EXPIRES_NAME = getattr(settings, 'SOCIAL_AUTH_EXPIRATION', 'expires') # white-listed domains (else accept all) -WHITE_LISTED_DOMAINS = getattr(settings, 'WHITE_LISTED_DOMAINS', None) +WHITE_LISTED_DOMAINS = getattr(settings, 'WHITE_LISTED_DOMAINS', []) # Backends class GoogleOAuthBackend(OAuthBackend): @@ -87,7 +87,7 @@ class GoogleBackend(OpenIDBackend): import re for domain in WHITE_LISTED_DOMAINS: if not re.search(domain, details['email']): - raise Exception, 'INVALID DOMAIN' + raise ValueError('INVALID DOMAIN') return details['email']