From 923df9001495c64ea693b69fe2bb16b7675f845e Mon Sep 17 00:00:00 2001 From: Mustafa Yontar Date: Sun, 31 Jan 2021 02:17:24 +0300 Subject: [PATCH] change password generator --- models/Union.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()