From 27903b598497293b68520da5a4ab44eed04a4ce3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 27 Mar 2017 22:44:51 -0500 Subject: [PATCH] Fix core view auto-logout inactive user logic, for tests --- tailbone/views/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tailbone/views/core.py b/tailbone/views/core.py index 67d270dd..e30d31f2 100644 --- a/tailbone/views/core.py +++ b/tailbone/views/core.py @@ -45,9 +45,12 @@ class View(object): def __init__(self, request): self.request = request - if request.user and not request.user.active: + + # 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')) + config = self.rattail_config if config: self.enum = config.get_enum()