[ldap_crans, gest_crans] redirection mail à l'inscription
darcs-hash:20100901131100-ffbb2-8e57b251130f3a7d1c257c24dc87614710e66fbb.gz
This commit is contained in:
parent
b3dd9a4ce2
commit
99c7d8561d
2 changed files with 27 additions and 2 deletions
|
@ -104,7 +104,11 @@ class home:
|
||||||
for args in self.args:
|
for args in self.args:
|
||||||
anim('\t' + args)
|
anim('\t' + args)
|
||||||
try:
|
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":
|
if home.startswith('/home/') and hostname == "fx":
|
||||||
home = "/home-adh/" + home[6:]
|
home = "/home-adh/" + home[6:]
|
||||||
### Home
|
### Home
|
||||||
|
@ -135,6 +139,11 @@ class home:
|
||||||
os.mkdir('/home-adh/mail/' + login, 0770)
|
os.mkdir('/home-adh/mail/' + login, 0770)
|
||||||
os.chown('/home-adh/mail/' + login, int(uid), 8)
|
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:
|
except:
|
||||||
print ERREUR
|
print ERREUR
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
|
|
@ -1834,13 +1834,29 @@ class BaseProprietaire(BaseClasseCrans):
|
||||||
args = self._data['homeDirectory'][0] + ','
|
args = self._data['homeDirectory'][0] + ','
|
||||||
args+= self._data['uidNumber'][0] + ','
|
args+= self._data['uidNumber'][0] + ','
|
||||||
args+= self._data['uid'][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")
|
r = prompt(u"Attribuer tout de suite un mot de passe ? [O/N]", "O")
|
||||||
if r == 'O' or r == 'o':
|
if r == 'O' or r == 'o':
|
||||||
chgpass(self.dn)
|
chgpass(self.dn)
|
||||||
else:
|
else:
|
||||||
ret += coul(u' Il faudra penser à attribuer un mot de passe\n', 'jaune')
|
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 ?
|
# Modif des droits ?
|
||||||
if 'droits' in self.modifs:
|
if 'droits' in self.modifs:
|
||||||
self.services_to_restart('droits')
|
self.services_to_restart('droits')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue