Handle no session yet properly
All checks were successful
docker-image / docker (push) Successful in 1m22s
All checks were successful
docker-image / docker (push) Successful in 1m22s
This commit is contained in:
parent
292185bb7d
commit
7b6ad28168
1 changed files with 3 additions and 1 deletions
|
@ -93,7 +93,9 @@ def post_api_lock(id):
|
||||||
@jinja2_view("not_authorized.html.j2")
|
@jinja2_view("not_authorized.html.j2")
|
||||||
def not_authorized(error):
|
def not_authorized(error):
|
||||||
code, msg = error.args
|
code, msg = error.args
|
||||||
groups = request.session[auth.sess_attr]['groups'] if 'groups' in request.session[auth.sess_attr] else []
|
groups = []
|
||||||
|
if auth.sess_attr in request.session and 'groups' in request.session[auth.sess_attr]:
|
||||||
|
groups = request.session[auth.sess_attr]['groups']
|
||||||
return {
|
return {
|
||||||
'user': auth.my_username,
|
'user': auth.my_username,
|
||||||
'ip': request.remote_addr,
|
'ip': request.remote_addr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue