change password generator

remotes/1725865088694522691/master
Mustafa Yontar 4 years ago
parent 77641aa538
commit 923df90014
  1. 4
      models/Union.py

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

Loading…
Cancel
Save