1. Matthew Schinckel
  2. django-socialregistration

Commits

Adrián Ribao  committed 2725b6b

Check if the session key exists in request.session before deleting it.

  • Participants
  • Parent commits 014396f
  • Branches default

Comments (0)

Files changed (1)

File socialregistration/views.py

View file
  • Ignore whitespace
                 user = form.profile.authenticate()
                 login(request, user)
 
-                del request.session['socialregistration_user']
-                del request.session['socialregistration_profile']
+                if 'socialregistration_user' in request.session: del request.session['socialregistration_user']
+                if 'socialregistration_profile' in request.session: del request.session['socialregistration_profile']
 
                 return HttpResponseRedirect(_get_next(request))
 
         login(request, user)
 
         # Clear & Redirect
-        del request.session['socialregistration_user']
-        del request.session['socialregistration_profile']
+        if 'socialregistration_user' in request.session: del request.session['socialregistration_user']
+        if 'socialregistration_profile' in request.session: del request.session['socialregistration_profile']
         return HttpResponseRedirect(_get_next(request))
 
 if has_csrf: