8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Le home est une methode + règle les problèmes de la casse sur le pseudo

This commit is contained in:
detraz 2018-09-08 21:11:04 +02:00 committed by chirac
parent 5b347f3db4
commit 9fdadaf478

View file

@ -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]