Merge branch 'dev' into feature/support_auth_by_api_key

This commit is contained in:
Timothy Jaeryang Baek authored and GitHub committed 2024-04-02 09:12:19 -07:00
commit 56369fea3a
35 files changed
+1230 -324

No files matched your search

+8
View File
@@ -139,6 +139,14 @@ class AuthsTable:
return user
else:
return None
def authenticate_user_by_trusted_header(self, email: str) -> Optional[UserModel]:
log.info(f"authenticate_user_by_trusted_header: {email}")
try:
auth = Auth.get(Auth.email == email, Auth.active == True)
if auth:
user = Users.get_user_by_id(auth.id)
return user
except:
return None