forked from ScoDoc/ScoDoc
Merge pull request 'complements_email_check_from_9.0.52' (#160) from jmplace/ScoDoc-Lille:complements_email_check_from_9.0.52 into master
Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/160
This commit is contained in:
commit
f0d641a31e
@ -179,11 +179,12 @@ def import_users(users):
|
||||
user_ok, msg = sco_users.check_modif_user(
|
||||
0,
|
||||
ignore_optionals=False,
|
||||
ajout_en_masse=True,
|
||||
user_name=u["user_name"],
|
||||
nom=u["nom"],
|
||||
prenom=u["prenom"],
|
||||
email=u["email"],
|
||||
roles=u["roles"].split(","),
|
||||
roles=[r for r in u["roles"].split(",") if r],
|
||||
dept=u["dept"],
|
||||
)
|
||||
if not user_ok:
|
||||
|
@ -388,6 +388,7 @@ def user_info_page(user_name=None):
|
||||
def check_modif_user(
|
||||
edit,
|
||||
ignore_optionals=False,
|
||||
ajout_en_masse=False,
|
||||
user_name="",
|
||||
nom="",
|
||||
prenom="",
|
||||
@ -402,9 +403,12 @@ def check_modif_user(
|
||||
(si ok est faux, l'utilisateur peut quand même forcer la creation)
|
||||
- msg: message warning à presenter à l'utilisateur
|
||||
"""
|
||||
MSG_OPT = """
|
||||
(vous pouvez forcer l'opération en cochant "<em>Ignorer les avertissements</em>" en bas de page)
|
||||
"""
|
||||
if ajout_en_masse:
|
||||
MSG_OPT = (
|
||||
"""<br/>Impossible de forcer l'opération lors d'une importation en masse"""
|
||||
)
|
||||
else:
|
||||
MSG_OPT = """<br/>Attention: (vous pouvez forcer l'opération en cochant "<em>Ignorer les avertissements</em>" en bas de page)"""
|
||||
# ce login existe ?
|
||||
user = _user_list(user_name)
|
||||
if edit and not user: # safety net, le user_name ne devrait pas changer
|
||||
@ -438,7 +442,7 @@ def check_modif_user(
|
||||
and dept != ""
|
||||
and Departement.query.filter_by(acronym=dept).first() is None
|
||||
):
|
||||
return False, "département '%s' inexistant" % u["dept"] + MSG_OPT
|
||||
return False, "département '%s' inexistant" % dept + MSG_OPT
|
||||
if ignore_optionals and not roles:
|
||||
return False, "aucun rôle sélectionné, êtes vous sûr ?" + MSG_OPT
|
||||
# ok
|
||||
|
@ -380,14 +380,14 @@ def create_user_form(user_name=None, edit=0, all_roles=1):
|
||||
if err:
|
||||
H.append(tf_error_message("""Erreur: %s""" % err))
|
||||
return "\n".join(H) + "\n" + tf[1] + F
|
||||
|
||||
ok, msg = sco_users.check_modif_user(
|
||||
edit,
|
||||
ignore_optionals=force,
|
||||
ignore_optionals=not force,
|
||||
user_name=user_name,
|
||||
nom=vals["nom"],
|
||||
prenom=vals["prenom"],
|
||||
email=vals["email"],
|
||||
dept=vals["dept"],
|
||||
roles=vals["roles"],
|
||||
)
|
||||
if not ok:
|
||||
@ -548,7 +548,7 @@ def import_users_form():
|
||||
H.append("<li>%s</li>" % d)
|
||||
H.append("</ul>")
|
||||
if ok:
|
||||
dest = url_for("users.index_html", scodoc_dept=g.scodoc_dept)
|
||||
dest = url_for("users.index_html", scodoc_dept=g.scodoc_dept, all_depts=1)
|
||||
H.append("<p>Ok, Import terminé (%s utilisateurs créés)!</p>" % nb_created)
|
||||
H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % dest)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user