add password auth
This commit is contained in:
parent
51f1a5a2d8
commit
c20d437b55
@ -37,6 +37,13 @@ class UserService:
|
||||
raise NameNotAllowedError(disallowed_char)
|
||||
return self._db_service.update_user(user)
|
||||
|
||||
def is_login_valid(self, user_name_or_mail: str, password_clear_text: str) -> bool:
|
||||
user = self.get_user(user_name_or_mail)
|
||||
if not user:
|
||||
return False
|
||||
return user.user_password == sha256(password_clear_text.encode(encoding="utf-8")).hexdigest()
|
||||
|
||||
|
||||
def _check_for_disallowed_char(self, name: str) -> Optional[str]:
|
||||
for c in name:
|
||||
if c not in self.ALLOWED_USER_NAME_SYMBOLS:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user