Fix error when not logged in

This commit is contained in:
Matthew Welch 2021-08-29 15:59:43 -07:00
parent 105706680b
commit 03f2a50aaa

View File

@ -16,11 +16,19 @@ app.register_blueprint(admin.Admin)
@app.context_processor
def func():
return {
"user_authenticated": current_user.is_authenticated,
if current_user.is_authenticated:
data = {
"user_authenticated": True,
"has_admin_access": current_user.has_permission("admin_site_access"),
"is_admin": current_user.has_role("admin"),
}
else:
data = {
"user_authenticated": False,
"has_admin_access": False,
"is_admin": False,
}
return data
@app.route("/")