async def authenticate(self, username: str, password: str) -> Optional[models.User]: user = await self.model.get(username=username) if not user: return None if not verify_password(password, user.password): return None return user
def authenticate(self, db: Session, *, username: str, password: str) -> Optional[User]: user = self.get_by_username(db, username=username) if not user: return None if not verify_password(password, user.password): return None return user
def authenticate( self, db_session: Session, *, email: str, password: str ) -> Optional[User]: user = self.get_by_email(db_session, email=email) if not user: return None if not verify_password(password, user.password): return None return user