change password generator

pull/5/head
Mustafa Yontar 4 years ago
parent 77641aa538
commit 923df90014
  1. 4
      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()

Loading…
Cancel
Save