New padding.

This commit is contained in:
2025-01-29 00:33:00 +01:00
parent 9e94210bc3
commit 84e5bac1b9
11 changed files with 41 additions and 8 deletions
+6
View File
@@ -13,11 +13,17 @@ class UserService(BaseService):
return False
return True
async def save(self, user):
if not user['color']:
user['color'] = await self.services.util.random_light_hex_color()
return await super().save(user)
async def register(self, email, username, password):
if await self.exists(username=username):
raise Exception("User already exists.")
model = await self.new()
model["nick"] = username
model['color'] = await self.services.util.random_light_hex_color()
model.email.value = email
model.username.value = username
model.password.value = await security.hash(password)