diff --git a/models/Union.py b/models/Union.py index 0dcefb6..443a3e4 100644 --- a/models/Union.py +++ b/models/Union.py @@ -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()