mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 09:52:38 +02:00
13 lines
346 B
Python
13 lines
346 B
Python
from fastapi import Request
|
|
from fastapi.responses import RedirectResponse
|
|
|
|
|
|
class NotAuthenticatedException(Exception):
|
|
pass
|
|
|
|
|
|
def auth_exception_handler(request: Request, exc: NotAuthenticatedException):
|
|
"""
|
|
Redirect the user to the login page if not logged in
|
|
"""
|
|
return RedirectResponse(url=request.url_for("login_view"))
|