Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ares
re2o-ares-admin
Commits
1cdd2d44
Commit
1cdd2d44
authored
Aug 26, 2016
by
chirac
Browse files
Fix linux user validator
parent
416cf0af
Changes
1
Hide whitespace changes
Inline
Side-by-side
users/models.py
View file @
1cdd2d44
...
...
@@ -16,11 +16,11 @@ from django.utils import timezone
from
django.contrib.auth.models
import
AbstractBaseUser
,
BaseUserManager
def
linux_user_
check
(
login
):
def
linux_user_
validator
(
login
):
""" Validation du pseudo pour respecter les contraintes unix"""
UNIX_LOGIN_PATTERN
=
re
.
compile
(
"^[a-z_][a-z0-9_-]*[$]?$"
)
if
not
UNIX_LOGIN_PATTERN
.
match
(
login
):
raise
forms
.
ValidationError
(
"Ce login n'est pas valide"
)
raise
forms
.
ValidationError
(
"Ce login n'est pas valide
et contient des carractères interdits
"
)
return
def
mailalias_check
(
alias
):
...
...
@@ -30,14 +30,6 @@ def mailalias_check(alias):
raise
forms
.
ValidationError
(
"Cet alias n'est pas valide"
)
return
def
linux_user_validator
(
login
):
if
not
linux_user_check
(
login
):
raise
forms
.
ValidationError
(
", ce pseudo ('%(label)s') contient des carractères interdits"
,
params
=
{
'label'
:
login
},
)
def
get_admin_right
():
try
:
admin_right
=
ListRight
.
objects
.
get
(
listright
=
"admin"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment