mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-04 17:06:27 +00:00
Merge branch '2-generation-automatique-de-nom-dns' into 'master'
Resolve "Génération automatique de nom DNS" Closes #2 See merge request !2
This commit is contained in:
commit
3b11409d68
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
pseudo=pseudo,
|
||||
|
|
Loading…
Reference in a new issue