Fix bug when request.user becomes unattached from session (?)
this sure seems unexpected. so far the behavior has only been seen on mobile when a new ordering batch was created
This commit is contained in:
parent
961249722f
commit
6ae129ea24
|
@ -47,9 +47,14 @@ class View(object):
|
|||
self.request = request
|
||||
|
||||
# if user becomes inactive while logged in, log them out
|
||||
if getattr(request, 'user', None) and not request.user.active:
|
||||
headers = logout_user(request)
|
||||
raise self.redirect(request.route_url('home'))
|
||||
if getattr(request, 'user', None):
|
||||
# TODO: why is the user sometimes not attached to session?
|
||||
# (this has only been seen on mobile, when creating a new ordering batch)
|
||||
if request.user not in Session():
|
||||
request.user = Session.merge(request.user)
|
||||
if not request.user.active:
|
||||
headers = logout_user(request)
|
||||
raise self.redirect(request.route_url('home'))
|
||||
|
||||
config = self.rattail_config
|
||||
if config:
|
||||
|
|
Loading…
Reference in a new issue