mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
Add unauthorized_handler to UI
This commit is contained in:
parent
5ac64758e3
commit
c671ccf7a2
1 changed files with 7 additions and 0 deletions
|
@ -253,6 +253,13 @@ def load_user(user_id):
|
|||
return User(user_id, vars["ADMIN_PASSWORD"])
|
||||
|
||||
|
||||
@login_manager.unauthorized_handler
|
||||
def unauthorized_callback():
|
||||
if request.path == "/":
|
||||
return redirect(url_for("login"))
|
||||
return "Unauthorized", 401
|
||||
|
||||
|
||||
# CSRF protection
|
||||
csrf = CSRFProtect()
|
||||
csrf.init_app(app)
|
||||
|
|
Loading…
Reference in a new issue