From eb736dcaee566304d8ca2a1fe644093890e04050 Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Sat, 9 May 2020 21:07:54 +0200 Subject: [PATCH] add redirect to login --- lenticular_cloud/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lenticular_cloud/app.py b/lenticular_cloud/app.py index e4365fb..0284f31 100644 --- a/lenticular_cloud/app.py +++ b/lenticular_cloud/app.py @@ -1,5 +1,5 @@ from flask.app import Flask -from flask import g +from flask import g, redirect from flask.helpers import url_for from jwkest.jwk import RSAKey, rsa_load from flask_babel import Babel @@ -171,3 +171,7 @@ def init_login_manager(app): @app.login_manager.request_loader def request_loader(request): pass + + @app.login_manager.unauthorized_handler + def unauthorized(): + return redirect(url_for('auth.login'))