This commit is contained in:
2025-06-07 05:47:54 +02:00
parent f182c2209e
commit 389d417c1b
45 changed files with 2157 additions and 1234 deletions
+4 -6
View File
@@ -32,14 +32,14 @@ class UserService(BaseService):
user["color"] = await self.services.util.random_light_hex_color()
return await super().save(user)
def authenticate_sync(self,username,password):
def authenticate_sync(self, username, password):
user = self.get_by_username_sync(username)
if not user:
return False
if not security.verify_sync(password, user["password"]):
return False
return True
return True
async def authenticate(self, username, password):
success = await self.validate_login(username, password)
@@ -61,14 +61,12 @@ class UserService(BaseService):
return None
return path
async def get_template_path(self, user_uid):
path = pathlib.Path(f"./drive/{user_uid}/snek/templates")
if not path.exists():
return None
return path
def get_by_username_sync(self, username):
user = self.mapper.db["user"].find_one(username=username, deleted_at=None)
return dict(user)