diff --git a/gestion/gen_confs/adherents.py b/gestion/gen_confs/adherents.py index 9c1b1032..952b91d0 100644 --- a/gestion/gen_confs/adherents.py +++ b/gestion/gen_confs/adherents.py @@ -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: diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index cd4445d2..c29591e9 100644 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -1834,12 +1834,28 @@ 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: