mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Le home est une methode + règle les problèmes de la casse sur le pseudo
This commit is contained in:
parent
5b347f3db4
commit
9fdadaf478
1 changed files with 6 additions and 2 deletions
|
@ -93,7 +93,7 @@ from preferences.models import OptionalMachine, MailMessageOption
|
|||
|
||||
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-Z][a-zA-Z0-9-]*[$]?$")
|
||||
return UNIX_LOGIN_PATTERN.match(login)
|
||||
|
||||
|
||||
|
@ -374,6 +374,10 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
|||
si il n'est pas défini"""
|
||||
return self.shell or OptionalUser.get_cached_value('shell_default')
|
||||
|
||||
@cached_property
|
||||
def home_directory(self):
|
||||
return '/home/' + self.pseudo
|
||||
|
||||
@cached_property
|
||||
def get_shadow_expire(self):
|
||||
"""Return the shadow_expire value for the user"""
|
||||
|
@ -581,7 +585,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
|||
user_ldap.name = self.pseudo
|
||||
user_ldap.sn = self.pseudo
|
||||
user_ldap.dialupAccess = str(self.has_access())
|
||||
user_ldap.home_directory = '/home/' + self.pseudo
|
||||
user_ldap.home_directory = self.home_directory
|
||||
user_ldap.mail = self.get_mail
|
||||
user_ldap.given_name = self.surname.lower() + '_'\
|
||||
+ self.name.lower()[:3]
|
||||
|
|
Loading…
Reference in a new issue