1
0
forked from ScoDoc/ScoDoc

Merge pull request 'fix_user ; always send from no-reply ; reset passwd_temp' (#294) from jmplace/ScoDoc-Lille:fix_users into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/294
This commit is contained in:
Emmanuel Viennet 2022-01-25 11:36:45 +01:00
commit a78bb4bc1c
2 changed files with 4 additions and 3 deletions

View File

@ -112,6 +112,7 @@ class User(UserMixin, db.Model):
self.password_hash = generate_password_hash(password)
else:
self.password_hash = None
self.passwd_temp = False
def check_password(self, password):
"""Check given password vs current one.

View File

@ -154,7 +154,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
if user_name is not None: # scodoc7func converti en int !
user_name = str(user_name)
auth_dept = current_user.dept
from_mail = current_user.email
from_mail = current_app.config["SCODOC_MAIL_FROM"] # current_user.email
initvalues = {}
edit = int(edit)
all_roles = int(all_roles)
@ -577,8 +577,8 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
# A: envoi de welcome + procedure de reset
# B: envoi de welcome seulement (mot de passe saisie dans le formulaire)
# C: Aucun envoi (mot de passe saisi dans le formulaire)
if vals["welcome"] == "1":
if vals["reset_password:list"] == "1":
if vals["welcome"] != "1":
if vals["reset_password"] != "1":
mode = Mode.WELCOME_AND_CHANGE_PASSWORD
else:
mode = Mode.WELCOME_ONLY