Skip to content
Browse files

Merge branch 'master' of github.com:mozilla/FlightDeck

  • Loading branch information...
2 parents 91be339 + d32d0fd commit 798de3a1b8faffc7b51f88f0e27939db1afd3d3c @zalun zalun committed
Showing with 8 additions and 12 deletions.
  1. +8 −12 apps/person/views.py
View
20 apps/person/views.py
@@ -135,25 +135,19 @@ def browserid_authenticate(request, assertion):
mail_admins( 'Problem with browserID authentication', str(err))
except Http404, err:
# AMO responded with 404
- log.error("[browserID] 404 Error from AMO: %s" % str(err))
- # get the API url
- # TODO think about a simpler way to return the URL to admins
- amo = AMOOAuth(domain=settings.AMOOAUTH_DOMAIN,
- port=settings.AMOOAUTH_PORT,
- protocol=settings.AMOOAUTH_PROTOCOL,
- prefix=settings.AMOOAUTH_PREFIX)
- amo.set_consumer(consumer_key=settings.AMOOAUTH_CONSUMERKEY,
- consumer_secret=settings.AMOOAUTH_CONSUMERSECRET)
- mail_admins( 'AMO get_user responding with 404',
- 'Requested URL: %s' % amo.url('user'))
+ log.error("[browserID] 404 Error from AMO, probably user not found")
+ return (None, None)
else:
- if amouser == None:
+ if not amouser or 'id' not in amouser:
+ mail_admins('AMO user API returned no data',
+ 'It supposed to raise 404')
return (None, None)
id = amouser['id']
if id:
try:
user = User.objects.get(username=id)
except User.DoesNotExist:
+ # user exists on AMO, but not on Builder - create user
user = User.objects.create(username=id, email=email)
profile = Profile.objects.create(user=user)
except Exception:
@@ -166,6 +160,8 @@ def browserid_authenticate(request, assertion):
except Profile.DoesNotExist:
profile = Profile.objects.create(user=user)
else:
+ # this now happens only for ValueError (probably never)
+ mail_admins('No id returned from AMO', 'Just a flag this code is used')
try:
user = User.objects.get(email=email)
except User.DoesNotExist:

0 comments on commit 798de3a

Please sign in to comment.
Something went wrong with that request. Please try again.