X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister.php;h=16d0f2090accee22cb741b0ebf7d731d9408b02d;hb=e5858f67fe357e76fae0b08c481bc8d49f4a20a8;hp=6c55a23d73212fe8f54766cdc64bb04f4af9ba69;hpb=ce0d1dc499385336e92fd24a8b11e055910046f2;p=platal.git diff --git a/modules/register.php b/modules/register.php index 6c55a23..16d0f20 100644 --- a/modules/register.php +++ b/modules/register.php @@ -31,6 +31,8 @@ class RegisterModule extends PLModule function handler_register($page, $hash = null) { + $page->forceSkin('register'); + $alert = array(); $alert_details = ''; $subState = new PlDict(S::v('subState', array())); @@ -155,9 +157,10 @@ class RegisterModule extends PLModule // Validate the email address format and domain. require_once 'emails.inc.php'; + $user = User::get($subState->s('uid')); if (!isvalid_email(Post::v('email'))) { $error[] = "Le champ 'Email' n'est pas valide."; - } elseif (!isvalid_email_redirection(Post::v('email'))) { + } elseif (!isvalid_email_redirection(Post::v('email'), $user)) { $error[] = $subState->s('forlife') . ' doit renvoyer vers un email existant ' . 'valide, en particulier, il ne peut pas être renvoyé vers lui-même.'; } @@ -292,7 +295,7 @@ class RegisterModule extends PLModule $res = XDB::query("SELECT r.uid, p.pid, r.forlife, r.bestalias, r.mailorg2, r.password, r.email, r.services, r.naissance, ppn.lastname_initial, ppn.firstname_initial, pe.promo_year, - pd.promo, p.sex, p.birthdate_ref, a.type + pd.promo, p.sex, p.birthdate_ref, a.type, a.email AS old_account_email FROM register_pending AS r INNER JOIN accounts AS a ON (r.uid = a.uid) INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) @@ -318,7 +321,7 @@ class RegisterModule extends PLModule } list($uid, $pid, $forlife, $bestalias, $emailXorg2, $password, $email, $services, - $birthdate, $lastname, $firstname, $yearpromo, $promo, $sex, $birthdate_ref, $type) = $res->fetchOneRow(); + $birthdate, $lastname, $firstname, $yearpromo, $promo, $sex, $birthdate_ref, $type, $old_account_email) = $res->fetchOneRow(); $isX = ($type == 'x'); $mail_domain = User::$sub_mail_domains[$type] . $globals->mail->domain; @@ -377,9 +380,17 @@ class RegisterModule extends PLModule $redirect->add_email($email); fix_bestalias($user); + // If the user was registered to some aliases and MLs, we must change + // the subscription to her forlife email. + if ($old_account_email) { + $listClient = new MMList($user); + $listClient->change_user_email($old_account_email, $user->forlifeEmail()); + update_alias_user($old_account_email, $user->forlifeEmail()); + } + // Try to start a session (so the user don't have to log in); we will use // the password available in Post:: to authenticate the user. - Platal::session()->start(AUTH_MDP); + Platal::session()->start(AUTH_PASSWD); // Subscribe the user to the services she did request at registration time. require_once 'newsletter.inc.php';