Fix error when not logged in
This commit is contained in:
parent
105706680b
commit
03f2a50aaa
@ -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("/")
|
||||
|
Loading…
Reference in New Issue
Block a user