diff --git a/agenda/auth.py b/agenda/auth.py index fefbee9..3e2f2b8 100644 --- a/agenda/auth.py +++ b/agenda/auth.py @@ -21,16 +21,13 @@ def verify_auth_token(token: str) -> str | None: def require_authentication() -> werkzeug.Response | None: """Require authentication and redirect with return URL.""" - if not flask.current_app.config.get("REQUIRE_AUTH"): - return None - token = flask.request.cookies.get("auth_token") if token and verify_auth_token(token): return None # Construct the redirect URL with the original URL as a parameter return flask.redirect( - flask.current_app.config["UNIAUTH_URL"] - + "/login?next=" + flask.current_app.config["UNIAUTH_LOGIN_URL"] + + "?next=" + werkzeug.urls.url_quote(flask.request.url) )