Merge pull request #1347 from cheahjs/feat/trusted-email-header

feat: allow authenticating with a trusted email header
This commit is contained in:
Timothy Jaeryang Baek
2024-04-02 09:11:25 -07:00
committed by GitHub
9 changed files with 158 additions and 99 deletions

View File

@@ -123,6 +123,16 @@ class AuthsTable:
except:
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
def update_user_password_by_id(self, id: str, new_password: str) -> bool:
try:
query = Auth.update(password=new_password).where(Auth.id == id)