Fix: create user avec date exp.

This commit is contained in:
Emmanuel Viennet 2021-10-07 23:00:02 +02:00
parent 47f1497e5e
commit b38ee4ea25

View File

@ -400,17 +400,6 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
return "\n".join(H) + "\n" + tf[1] + F
if edit: # modif utilisateur (mais pas password ni user_name !)
if (not can_choose_dept) and "dept" in vals:
del vals["dept"]
if "password" in vals:
del vals["passwordd"]
if "date_modif_passwd" in vals:
del vals["date_modif_passwd"]
if "user_name" in vals:
del vals["user_name"]
if (current_user.user_name == user_name) and "status" in vals:
del vals["status"] # no one can't change its own status
if "date_expiration" in vals:
try:
if vals["date_expiration"]:
@ -422,6 +411,18 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
except ValueError:
H.append(tf_error_message("date expiration invalide"))
return "\n".join(H) + "\n" + tf[1] + F
if edit: # modif utilisateur (mais pas password ni user_name !)
if (not can_choose_dept) and "dept" in vals:
del vals["dept"]
if "password" in vals:
del vals["passwordd"]
if "date_modif_passwd" in vals:
del vals["date_modif_passwd"]
if "user_name" in vals:
del vals["user_name"]
if (current_user.user_name == user_name) and "status" in vals:
del vals["status"] # no one can't change its own status
if "status" in vals:
vals["active"] = vals["status"] == ""
# traitement des roles: ne doit pas affecter les roles