|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
from mongoengine import * |
|
|
|
|
from werkzeug.security import generate_password_hash |
|
|
|
|
from string import printable |
|
|
|
|
from string import ascii_letters, digits |
|
|
|
|
from random import choices |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ class Union(Document): |
|
|
|
|
user.username = "{}@root".format(self.legal_registration_number) |
|
|
|
|
user.user_group = group |
|
|
|
|
user.union = self |
|
|
|
|
password = choices(printable, k=10) |
|
|
|
|
password = ''.join(choices(ascii_letters+digits, k=10)) |
|
|
|
|
user.password = generate_password_hash(password) |
|
|
|
|
# TODO: send password via mail or sms or nothing |
|
|
|
|
user.save() |
|
|
|
|