New padding.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user