8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-08-10 17:25:02 +00:00

Fix error preventing migration

This commit is contained in:
Jean-Romain Garnier 2020-04-17 18:01:35 +02:00 committed by Jean-Romain Garnier
parent 1484b6ec1e
commit 3c5e538218

View file

@ -405,7 +405,6 @@ class AdherentCreationForm(AdherentForm):
AdherentForm auquel on ajoute une checkbox afin d'éviter les AdherentForm auquel on ajoute une checkbox afin d'éviter les
doublons d'utilisateurs et, optionnellement, doublons d'utilisateurs et, optionnellement,
un champ mot de passe""" un champ mot de passe"""
if OptionalUser.get_cached_value("allow_set_password_during_user_creation"):
# Champ pour choisir si un lien est envoyé par mail pour le mot de passe # Champ pour choisir si un lien est envoyé par mail pour le mot de passe
init_password_by_mail_info = _( init_password_by_mail_info = _(
"If this options is set, you will receive a link to set" "If this options is set, you will receive a link to set"
@ -481,6 +480,12 @@ class AdherentCreationForm(AdherentForm):
) )
) )
# Remove password fields if option is disabled
if not OptionalUser.get_cached_value("allow_set_password_during_user_creation"):
self.fields.pop("init_password_by_mail")
self.fields.pop("password1")
self.fields.pop("password2")
def clean_password1(self): def clean_password1(self):
"""Ignore ce champs si la case init_password_by_mail est décochée""" """Ignore ce champs si la case init_password_by_mail est décochée"""
send_email = self.cleaned_data.get("init_password_by_mail") send_email = self.cleaned_data.get("init_password_by_mail")