8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-24 07:53:47 +00:00

Fix 170: Ajout d'une case à cocher pour éviter les doublons de comptes

This commit is contained in:
edpibu 2018-09-19 15:40:53 +02:00 committed by Alexandre Iooss
parent 90fec753dd
commit 311ad660c9
2 changed files with 18 additions and 1 deletions

View file

@ -375,6 +375,22 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
remove_user_room(self.cleaned_data.get('room')) remove_user_room(self.cleaned_data.get('room'))
return return
class AdherentCreationForm(AdherentForm):
"""Formulaire de création d'un user.
AdherentForm auquel on ajoute une checkbox afin d'éviter les
doublons d'utilisateurs"""
def __init__(self, *args, **kwargs):
super(AdherentCreationForm, self).__init__(*args, **kwargs)
# Champ permettant d'éviter au maxium les doublons d'utilisateurs
former_user_check_info = _("If you already have an account, please use it. "\
+ "If your lost access to it, please consider "\
+ "using the forgotten password button on the "\
+ "login page or contacting support.")
self.fields['former_user_check'] = forms.BooleanField(required=True,
help_text=former_user_check_info)
self.fields['former_user_check'].label = _("I have not had an account before")
class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Formulaire de base d'edition d'un user. Formulaire de base, utilisé """Formulaire de base d'edition d'un user. Formulaire de base, utilisé

View file

@ -100,6 +100,7 @@ from .forms import (
ServiceUserForm, ServiceUserForm,
ListRightForm, ListRightForm,
AdherentForm, AdherentForm,
AdherentCreationForm,
ClubForm, ClubForm,
MassArchiveForm, MassArchiveForm,
PassForm, PassForm,
@ -114,7 +115,7 @@ from .forms import (
def new_user(request): def new_user(request):
""" Vue de création d'un nouvel utilisateur, """ Vue de création d'un nouvel utilisateur,
envoie un mail pour le mot de passe""" envoie un mail pour le mot de passe"""
user = AdherentForm(request.POST or None, user=request.user) user = AdherentCreationForm(request.POST or None, user=request.user)
GTU_sum_up = GeneralOption.get_cached_value('GTU_sum_up') GTU_sum_up = GeneralOption.get_cached_value('GTU_sum_up')
GTU = GeneralOption.get_cached_value('GTU') GTU = GeneralOption.get_cached_value('GTU')
if user.is_valid(): if user.is_valid():