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
|
self.request = request
|
||||||
|
|
||||||
# if user becomes inactive while logged in, log them out
|
# if user becomes inactive while logged in, log them out
|
||||||
if getattr(request, 'user', None) and not request.user.active:
|
if getattr(request, 'user', None):
|
||||||
headers = logout_user(request)
|
# TODO: why is the user sometimes not attached to session?
|
||||||
raise self.redirect(request.route_url('home'))
|
# (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
|
config = self.rattail_config
|
||||||
if config:
|
if config:
|
||||||
|
|
Loading…
Reference in a new issue