1. Gregory Petukhov
  2. django-xauth

Commits

Gregory Petukhov  committed d610369

Fix openid issue: incorrect processing of cancelled openid response

  • Participants
  • Parent commits 94df69e
  • Branches simple

Comments (0)

Files changed (2)

File setup.py

View file
 
 
     setup(
-        version = '0.0.7',
+        version = '0.0.8',
         description = 'All-in-one django registration application',
         author = 'Grigoriy Petukhov',
         author_email = 'lorien@lorien.name',

File xauth/service/openid/views.py

View file
         logger.debug('Setting up the OpenID response object')
         response = con.complete(request_args, return_to)
 
-        profile = process_profile_data(response, settings.XAUTH_PROFILE_FIELDS)
 
         if response.status == consumer.SUCCESS:
+            profile = process_profile_data(response, settings.XAUTH_PROFILE_FIELDS)
+
             identity = response.identity_url
             request.session['xauth_response'] = {
                 'service': 'openid',
             }
             return redirect('xauth_complete')
         else:
-            messages.error(request, _('OpenID authentication failure: %s' % response.message))
+            if response.status == consumer.CANCEL:
+                messages.error(request, _('Authentication cancelled'))
+            elif response.status == consumer.FAILURE:
+                messages.error(request, _('OpenID authentication failure: %s' % response.message))
+            else:
+                messages.error(request, _('Unknown OpenID response type: %s' % response.status))
             return redirect('xauth_login')
     else:
         messages.error(request, u'Invalid openid data')