forked from ScoDoc/ScoDoc
Fix: create user avec date exp.
This commit is contained in:
parent
47f1497e5e
commit
b38ee4ea25
@ -400,6 +400,18 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
||||
|
||||
return "\n".join(H) + "\n" + tf[1] + F
|
||||
|
||||
if "date_expiration" in vals:
|
||||
try:
|
||||
if vals["date_expiration"]:
|
||||
vals["date_expiration"] = datetime.datetime.strptime(
|
||||
vals["date_expiration"], "%d/%m/%Y"
|
||||
)
|
||||
else:
|
||||
vals["date_expiration"] = None
|
||||
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"]
|
||||
@ -411,17 +423,6 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
||||
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"]:
|
||||
vals["date_expiration"] = datetime.datetime.strptime(
|
||||
vals["date_expiration"], "%d/%m/%Y"
|
||||
)
|
||||
else:
|
||||
vals["date_expiration"] = None
|
||||
except ValueError:
|
||||
H.append(tf_error_message("date expiration invalide"))
|
||||
return "\n".join(H) + "\n" + tf[1] + F
|
||||
if "status" in vals:
|
||||
vals["active"] = vals["status"] == ""
|
||||
# traitement des roles: ne doit pas affecter les roles
|
||||
|
Loading…
Reference in New Issue
Block a user