Merge pull request #160 from gazpachoking/github_auth_email

Use github's anonymous email when github auth user has private email
This commit is contained in:
Chase Sterling 2016-07-26 16:00:46 -04:00 committed by GitHub
commit 065a8c3327

View file

@ -40,7 +40,7 @@ providers = {
'field_map': { 'field_map': {
'id': 'id', 'id': 'id',
'username': 'login', 'username': 'login',
'email': 'email' 'email': lambda(data): data.get('email') or data['login'] + '@users.noreply.github.com'
}, },
'token_name': 'access_token' 'token_name': 'access_token'
}, },
@ -118,6 +118,8 @@ class User(BaseUser):
def get_value(d, key): def get_value(d, key):
if isinstance(key, basestring): if isinstance(key, basestring):
return d.get(key) return d.get(key)
elif callable(key):
return key(d)
# key should be list here # key should be list here
val = d.get(key.pop(0)) val = d.get(key.pop(0))
if len(key) == 0: if len(key) == 0: