Added redirect on 401 Unauthorized
This commit is contained in:
parent
f2e0be83b9
commit
6fa0ea598c
1 changed files with 5 additions and 1 deletions
6
login.py
6
login.py
|
@ -13,6 +13,10 @@ def load_user(userid):
|
|||
return User.query.filter_by(id=userid).first()
|
||||
|
||||
|
||||
@app.errorhandler(401)
|
||||
def custom_401(_):
|
||||
return redirect(url_for('login'))
|
||||
|
||||
@app.route('/login')
|
||||
def login():
|
||||
return zeus_login()
|
||||
|
@ -23,4 +27,4 @@ def logout():
|
|||
if 'zeus_token' in session:
|
||||
session.pop('zeus_token', None)
|
||||
logout_user()
|
||||
return redirect(url_for('all_users'))
|
||||
return redirect(url_for('all_users'))
|
||||
|
|
Loading…
Reference in a new issue