From 0a7c0731ade40c509e82b906fb2fb94297a1a154 Mon Sep 17 00:00:00 2001 From: Guillaume Goessel Date: Tue, 1 Aug 2017 13:46:29 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Utilisation=20du=20pseudo=20comme=20proposi?= =?UTF-8?q?tion=20par=20d=C3=A9faut=20DNS=20+=20Remplacement=20=C3=A0=20la?= =?UTF-8?q?=20vol=C3=A9e=20de=20l'underscore=20par=20un=20trait=20d'union?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machines/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/views.py b/machines/views.py index 6e0eb46b..45723df4 100644 --- a/machines/views.py +++ b/machines/views.py @@ -90,7 +90,7 @@ def new_machine(request, userid): machine = NewMachineForm(request.POST or None) interface = AddInterfaceForm(request.POST or None, infra=request.user.has_perms(('infra',))) nb_machine = Interface.objects.filter(machine__user=userid).count() - domain = DomainForm(request.POST or None, name_user=user.surname, nb_machine=nb_machine) + domain = DomainForm(request.POST or None, name_user=user.pseudo.replace('_','.'), nb_machine=nb_machine) if machine.is_valid() and interface.is_valid(): new_machine = machine.save(commit=False) new_machine.user = user From 70073786234a85301c8978ae25592c76d62eac57 Mon Sep 17 00:00:00 2001 From: Guillaume Goessel Date: Tue, 1 Aug 2017 13:51:59 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Interdiction=20de=20l'underscore=20dans=20l?= =?UTF-8?q?es=20pseudos=20pour=20ne=20pas=20cr=C3=A9er=20de=20conflit=20da?= =?UTF-8?q?ns=20les=20noms=20DNS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/models.py b/users/models.py index 472e02ba..c7503d75 100644 --- a/users/models.py +++ b/users/models.py @@ -58,7 +58,7 @@ def remove_user_room(room): def linux_user_check(login): """ Validation du pseudo pour respecter les contraintes unix""" - UNIX_LOGIN_PATTERN = re.compile("^[a-zA-Z0-9_-]*[$]?$") + UNIX_LOGIN_PATTERN = re.compile("^[a-zA-Z0-9-]*[$]?$") return UNIX_LOGIN_PATTERN.match(login) From 4f94d484d431b25ff2e5f70b408d1341ee29be62 Mon Sep 17 00:00:00 2001 From: Guillaume Goessel Date: Tue, 1 Aug 2017 14:12:27 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Ajustement=20de=20la=20suggestion=20des=20c?= =?UTF-8?q?aract=C3=A8res=20pour=20le=20pseudo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/models.py b/users/models.py index c7503d75..41eb969a 100644 --- a/users/models.py +++ b/users/models.py @@ -111,7 +111,7 @@ class UserManager(BaseUserManager): raise ValueError('Users must have an username') if not linux_user_check(pseudo): - raise ValueError('Username shall only contain [a-z0-9_-]') + raise ValueError('Username shall only contain [a-z0-9-]') user = self.model( pseudo=pseudo, From 53c759d8decdb9e8ea021369c097f589f4f6f02a Mon Sep 17 00:00:00 2001 From: Guillaume Goessel Date: Tue, 1 Aug 2017 14:34:58 +0200 Subject: [PATCH 4/4] Typo --- machines/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/views.py b/machines/views.py index 45723df4..d875ef15 100644 --- a/machines/views.py +++ b/machines/views.py @@ -90,7 +90,7 @@ def new_machine(request, userid): machine = NewMachineForm(request.POST or None) interface = AddInterfaceForm(request.POST or None, infra=request.user.has_perms(('infra',))) nb_machine = Interface.objects.filter(machine__user=userid).count() - domain = DomainForm(request.POST or None, name_user=user.pseudo.replace('_','.'), nb_machine=nb_machine) + domain = DomainForm(request.POST or None, name_user=user.pseudo.replace('_','-'), nb_machine=nb_machine) if machine.is_valid() and interface.is_valid(): new_machine = machine.save(commit=False) new_machine.user = user