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
|
@app.context_processor
|
||||||
def func():
|
def func():
|
||||||
return {
|
if current_user.is_authenticated:
|
||||||
"user_authenticated": current_user.is_authenticated,
|
data = {
|
||||||
"has_admin_access": current_user.has_permission("admin_site_access"),
|
"user_authenticated": True,
|
||||||
"is_admin": current_user.has_role("admin"),
|
"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("/")
|
@app.route("/")
|
||||||
|
Loading…
Reference in New Issue
Block a user