Skip to content

Commit

Permalink
handling case when user declines to share scopes (#6553)
Browse files Browse the repository at this point in the history
  • Loading branch information
smihai committed Mar 10, 2015
1 parent dac9cd2 commit cb408fc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ckanext/ozwillo_pyoidc/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ def callback(self):
g = model.Group.get(session['organization_id'])
client = Clients.get(g)
userinfo = client.callback(request.GET)
locale = None
log.info('Received userinfo: %s' % userinfo)
userobj = model.User.get(userinfo['sub'])
locale = userinfo.get('locale')
if '-' in locale:
locale, country = locale.split('-')

if userobj:
if 'sub' in userinfo:
locale = userinfo.get('locale', '')
if '-' in locale:
locale, country = locale.split('-')

userobj = model.User.get(userinfo['sub'])
if 'given_name' in userinfo:
userobj.fullname = userinfo['given_name']
if 'family_name' in userinfo:
Expand Down

0 comments on commit cb408fc

Please sign in to comment.