Compare commits
3 commits
d41d53367f
...
cc3dc81bdb
Author | SHA1 | Date | |
---|---|---|---|
Edward Betts | cc3dc81bdb | ||
Edward Betts | bdaad42eba | ||
Edward Betts | 389092cbb4 |
|
@ -21,13 +21,16 @@ 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_LOGIN_URL"]
|
||||
+ "?next="
|
||||
flask.current_app.config["UNIAUTH_URL"]
|
||||
+ "/login?next="
|
||||
+ werkzeug.urls.url_quote(flask.request.url)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue