[ldap_crans, gest_crans] redirection mail à l'inscription

darcs-hash:20100901131100-ffbb2-8e57b251130f3a7d1c257c24dc87614710e66fbb.gz
This commit is contained in:
Nicolas Dandrimont 2010-09-01 15:11:00 +02:00
parent b3dd9a4ce2
commit 99c7d8561d
2 changed files with 27 additions and 2 deletions

View file

@ -104,7 +104,11 @@ class home:
for args in self.args:
anim('\t' + args)
try:
home, uid, login = args.split(',')
try:
home, uid, login, mail_redirect = args.split(',')
except ValueError:
home, uid, login = args.split(',')
mail_redirect = None
if home.startswith('/home/') and hostname == "fx":
home = "/home-adh/" + home[6:]
### Home
@ -135,6 +139,11 @@ class home:
os.mkdir('/home-adh/mail/' + login, 0770)
os.chown('/home-adh/mail/' + login, int(uid), 8)
### Redirection
if mail_redirect:
file(home + '/.forward', 'w').write(mail_redirect + '\n')
os.chown(home + '/.forward', int(uid), config.gid)
except:
print ERREUR
if self.debug:

View file

@ -1834,13 +1834,29 @@ class BaseProprietaire(BaseClasseCrans):
args = self._data['homeDirectory'][0] + ','
args+= self._data['uidNumber'][0] + ','
args+= self._data['uid'][0]
self.services_to_restart('home', [ args ])
r = prompt(u"Attribuer tout de suite un mot de passe ? [O/N]", "O")
if r == 'O' or r == 'o':
chgpass(self.dn)
else:
ret += coul(u' Il faudra penser à attribuer un mot de passe\n', 'jaune')
r = prompt(u"Redirection mail ? [O/N]")
mail1 = mail2 = None
if r.lower().startswith('o'):
while True:
mail1 = prompt(u"Adresse mail ?")
try:
validate_mail(mail1)
except ValueError, e:
print coul(str(e), 'rouge')
continue
mail2 = prompt(u"Adresse mail (répéter) ?")
if mail1 == mail2 and mail1:
break
if mail1:
args += ',' + mail1
self.services_to_restart('home', [ args ])
# Modif des droits ?
if 'droits' in self.modifs:
self.services_to_restart('droits')