diff --git a/src/ezgg_lan_manager/services/UserService.py b/src/ezgg_lan_manager/services/UserService.py index 7295683..54d4505 100644 --- a/src/ezgg_lan_manager/services/UserService.py +++ b/src/ezgg_lan_manager/services/UserService.py @@ -59,11 +59,13 @@ class UserService: async def is_login_valid(self, user_name_or_mail: str, password_clear_text: str) -> bool: user = await self.get_user(user_name_or_mail) + user_password_hash = sha256(password_clear_text.encode(encoding="utf-8")).hexdigest() if not user: return False - if user.user_fallback_password: - user.user_fallback_password == sha256(password_clear_text.encode(encoding="utf-8")).hexdigest() - return user.user_password == sha256(password_clear_text.encode(encoding="utf-8")).hexdigest() + if user.user_fallback_password and user.user_fallback_password == user_password_hash: + return True + return user.user_password == user_password_hash + def _check_for_disallowed_char(self, name: str) -> Optional[str]: