From b11af9ea0e85d8c7a03c6b0b6512b9f5cf14cd57 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 2 Apr 2024 09:18:15 -0700 Subject: [PATCH] fix --- backend/apps/web/models/auths.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/apps/web/models/auths.py b/backend/apps/web/models/auths.py index cb8247769..09215e1be 100644 --- a/backend/apps/web/models/auths.py +++ b/backend/apps/web/models/auths.py @@ -48,9 +48,11 @@ class Token(BaseModel): token: str token_type: str + class ApiKey(BaseModel): api_key: Optional[str] = None + class UserResponse(BaseModel): id: str email: str @@ -132,6 +134,7 @@ class AuthsTable: # if no api_key, return None if not api_key: return None + try: auth = Auth.get(Auth.api_key == api_key, Auth.active == True) if auth: @@ -140,6 +143,9 @@ class AuthsTable: else: return None + except: + return False + def authenticate_user_by_trusted_header(self, email: str) -> Optional[UserModel]: log.info(f"authenticate_user_by_trusted_header: {email}") try: