Commits

crass  committed 9d7812a

request.session might not have _impersonate key anymore.

  • Participants
  • Parent commits b3932f5

Comments (0)

Files changed (1)

File impersonate/middleware.py

             else:
                 impersonate_stop(request, uid)
             
-            new_user = request.session['_impersonate']
-            if check_allow_for_user(request, new_user) and \
+            new_user = request.session.get('_impersonate', None)
+            if new_user and check_allow_for_user(request, new_user) and \
                check_allow_for_uri(request.path):
                 request.user = new_user
                 request.user.is_impersonate = True