From 52027500a65a362cf075784e2e6c5e46e3d114ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stef=20Oss=C3=A9?= Date: Sun, 10 Mar 2024 19:26:47 +0100 Subject: [PATCH] linting --- backend/controllers/auth/authentication_controller.py | 2 -- backend/domain/logic/user.py | 1 - backend/routes/login.py | 1 - backend/routes/user.py | 2 +- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/backend/controllers/auth/authentication_controller.py b/backend/controllers/auth/authentication_controller.py index 4933829f..75d14695 100644 --- a/backend/controllers/auth/authentication_controller.py +++ b/backend/controllers/auth/authentication_controller.py @@ -11,7 +11,6 @@ props: Properties = Properties() -# TODO: Should return a user object instead of a dict def authenticate_user(session: Session, ticket: str) -> UserDataclass | None: """ This function will authenticate the user. @@ -60,7 +59,6 @@ def parse_cas_xml(xml: str) -> dict | None: email: str = attributes_xml.find(f"{namespace}mail").text role: str = attributes_xml.findall(f"{namespace}objectClass") - # TODO: Checking if there are other roles that need to be added role_str: str = "" for r in role: if r.text == "ugentStudent" and role_str == "": diff --git a/backend/domain/logic/user.py b/backend/domain/logic/user.py index c4cf354b..823d0b88 100644 --- a/backend/domain/logic/user.py +++ b/backend/domain/logic/user.py @@ -36,7 +36,6 @@ def get_user_with_email(session: Session, email: str) -> UserDataclass | None: users = [r.to_domain_model() for r in result.scalars()] if len(users) > 1: - # TODO good error for more than 1 user with same email raise NotImplementedError if len(users) == 1: diff --git a/backend/routes/login.py b/backend/routes/login.py index 062c8dfd..2ac526f5 100644 --- a/backend/routes/login.py +++ b/backend/routes/login.py @@ -33,7 +33,6 @@ def login( return Response(status_code=401, content="Invalid Ticket!") -# TODO proper handle logout @login_router.get("/logout") def logout() -> Response: """ diff --git a/backend/routes/user.py b/backend/routes/user.py index 94d5da3d..8bc8c977 100644 --- a/backend/routes/user.py +++ b/backend/routes/user.py @@ -20,7 +20,7 @@ def get_current_user( session: Session = Depends(get_session), ) -> APIUser | None: token: str | None = request.cookies.get("token") - if token =="undefined": + if token is None: response.status_code = 401 return None user_id: int | None = verify_token(token)