@ -382,26 +382,27 @@ 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 """
# Champ pour choisir si un lien est envoyé par mail pour le mot de passe
if OptionalUser . get_cached_value ( " allow_set_password_during_user_creation " ) :
init_password_by_mail = forms . BooleanField ( required = False , initial = True )
# Champ pour choisir si un lien est envoyé par mail pour le mot de passe
init_password_by_mail . label = _ ( " Send password reset link by email. " )
init_password_by_mail = forms . BooleanField ( required = False , initial = True )
init_password_by_mail . label = _ ( " Send password reset link by email. " )
# Champs pour initialiser le mot de passe
# Validators are handled manually since theses fields aren't always required
# Champs pour initialiser le mot de passe
password1 = forms . CharField (
# Validators are handled manually since theses fields aren't always required
required = False ,
password1 = forms . CharField (
label = _ ( " Password " ) ,
required = False ,
widget = forms . PasswordInput ,
label = _ ( " Password " ) ,
# validators=[MinLengthValidator(8)],
widget = forms . PasswordInput ,
max_length = 255 ,
#validators=[MinLengthValidator(8)],
)
max_length = 255 ,
password2 = forms . CharField (
)
required = False ,
password2 = forms . CharField (
label = _ ( " Password confirmation " ) ,
required = False ,
widget = forms . PasswordInput ,
label = _ ( " Password confirmation " ) ,
# validators=[MinLengthValidator(8)],
widget = forms . PasswordInput ,
max_length = 255 ,
#validators=[MinLengthValidator(8)],
)
max_length = 255 ,
)
# Champ permettant d'éviter au maxium les doublons d'utilisateurs
# Champ permettant d'éviter au maxium les doublons d'utilisateurs
former_user_check_info = _ (
former_user_check_info = _ (
@ -476,7 +477,8 @@ class AdherentCreationForm(AdherentForm):
# Save the provided password in hashed format
# Save the provided password in hashed format
user = super ( AdherentForm , self ) . save ( commit = False )
user = super ( AdherentForm , self ) . save ( commit = False )
send_email = self . cleaned_data . get ( " init_password_by_mail " )
is_set_password_allowed = OptionalUser . get_cached_value ( " allow_set_password_during_user_creation " )
send_email = not is_set_password_allowed or self . cleaned_data . get ( " init_password_by_mail " )
if not send_email :
if not send_email :
user . set_password ( self . cleaned_data [ " password1 " ] )
user . set_password ( self . cleaned_data [ " password1 " ] )