chg: [authentication] add unauthorized_handler to redirect unauthorized user to login page.

pull/129/head
VVX7 2019-10-02 18:12:52 -04:00
parent 708addaa34
commit 88cc920bd3
1 changed files with 9 additions and 0 deletions

View File

@ -135,6 +135,15 @@ def load_user(user_id):
return User(user_id, "")
@login_manager.unauthorized_handler
def unauthorized():
"""
Redirect unauthorized user to login page.
:return:
"""
return redirect(url_for('login'))
@app.route('/logout')
@login_required
def logout():