Commit 3b11409d authored by guimoz's avatar guimoz
Browse files

Merge branch '2-generation-automatique-de-nom-dns' into 'master'

Resolve "Génération automatique de nom DNS"

Closes #2

See merge request !2
parents c50959d9 8bf71c10
......@@ -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 =
new_machine.user = user
......@@ -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)
......@@ -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(
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment