forked from ScoDoc/ScoDoc
typo
This commit is contained in:
parent
45d20789dd
commit
c68633bf5b
@ -102,10 +102,12 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
initvalues = {}
|
initvalues = {}
|
||||||
edit = int(edit)
|
edit = int(edit)
|
||||||
all_roles = int(all_roles)
|
all_roles = int(all_roles)
|
||||||
H = [html_sco_header.sco_header(
|
H = [
|
||||||
bodyOnLoad="init_tf_form('')",
|
html_sco_header.sco_header(
|
||||||
javascripts=["js/user_form.js"],
|
bodyOnLoad="init_tf_form('')",
|
||||||
)]
|
javascripts=["js/user_form.js"],
|
||||||
|
)
|
||||||
|
]
|
||||||
F = html_sco_header.sco_footer()
|
F = html_sco_header.sco_footer()
|
||||||
if edit:
|
if edit:
|
||||||
if not user_name:
|
if not user_name:
|
||||||
@ -220,7 +222,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
"size": 20,
|
"size": 20,
|
||||||
"allow_null": False,
|
"allow_null": False,
|
||||||
"explanation": "nom utilisé pour la connexion. Doit être unique parmi tous les utilisateurs. "
|
"explanation": "nom utilisé pour la connexion. Doit être unique parmi tous les utilisateurs. "
|
||||||
"Lettres ou chiffres uniquement.",
|
"Lettres ou chiffres uniquement.",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
("formsemestre_id", {"input_type": "hidden"}),
|
("formsemestre_id", {"input_type": "hidden"}),
|
||||||
@ -229,7 +231,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
{
|
{
|
||||||
"title": "Message d'accueil",
|
"title": "Message d'accueil",
|
||||||
"input_type": "checkbox",
|
"input_type": "checkbox",
|
||||||
"explanation": "Envoie un mail d'accueil à l'utilsateur.",
|
"explanation": "Envoie un mail d'accueil à l'utilisateur.",
|
||||||
"labels": ("",),
|
"labels": ("",),
|
||||||
"allowed_values": ("1",),
|
"allowed_values": ("1",),
|
||||||
"default": "1",
|
"default": "1",
|
||||||
@ -417,7 +419,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
nom=vals["nom"],
|
nom=vals["nom"],
|
||||||
prenom=vals["prenom"],
|
prenom=vals["prenom"],
|
||||||
email=vals["email"],
|
email=vals["email"],
|
||||||
dept=vals["dept"],
|
dept=vals.get("dept", auth_dept),
|
||||||
roles=vals["roles"],
|
roles=vals["roles"],
|
||||||
)
|
)
|
||||||
if not ok:
|
if not ok:
|
||||||
@ -478,17 +480,17 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
# A: envoi de welcome + procedure de reset
|
# A: envoi de welcome + procedure de reset
|
||||||
# B: envoi de welcome seulement (mot de passe saisie dans le formulaire)
|
# B: envoi de welcome seulement (mot de passe saisie dans le formulaire)
|
||||||
# C: Aucun envoi (mot de pase saisi dans le formulaire)
|
# C: Aucun envoi (mot de pase saisi dans le formulaire)
|
||||||
if vals['welcome:list'] == '1':
|
if vals["welcome:list"] == "1":
|
||||||
if vals['reset_password:list'] == '1':
|
if vals["reset_password:list"] == "1":
|
||||||
mode = 'A'
|
mode = "A"
|
||||||
else:
|
else:
|
||||||
mode = 'B'
|
mode = "B"
|
||||||
else:
|
else:
|
||||||
mode = 'C'
|
mode = "C"
|
||||||
|
|
||||||
# check passwords
|
# check passwords
|
||||||
if mode == 'A':
|
if mode == "A":
|
||||||
vals['password'] = generate_password()
|
vals["password"] = generate_password()
|
||||||
else:
|
else:
|
||||||
if vals["password"]:
|
if vals["password"]:
|
||||||
if vals["password"] != vals["password2"]:
|
if vals["password"] != vals["password2"]:
|
||||||
@ -513,8 +515,8 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
db.session.add(u)
|
db.session.add(u)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
# envoi éventuel d'un message
|
# envoi éventuel d'un message
|
||||||
if mode == 'A' or mode == 'B':
|
if mode == "A" or mode == "B":
|
||||||
if mode == 'A':
|
if mode == "A":
|
||||||
token = u.get_reset_password_token()
|
token = u.get_reset_password_token()
|
||||||
else:
|
else:
|
||||||
token = None
|
token = None
|
||||||
@ -523,7 +525,9 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
|||||||
sender=current_app.config["ADMINS"][0],
|
sender=current_app.config["ADMINS"][0],
|
||||||
recipients=[u.email],
|
recipients=[u.email],
|
||||||
text_body=render_template("email/welcome.txt", user=u, token=token),
|
text_body=render_template("email/welcome.txt", user=u, token=token),
|
||||||
html_body=render_template("email/welcome.html", user=u, token=token),
|
html_body=render_template(
|
||||||
|
"email/welcome.html", user=u, token=token
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
return flask.redirect(
|
return flask.redirect(
|
||||||
|
Loading…
Reference in New Issue
Block a user