X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister.php;h=c09d68dc278756a0c86b399e289505d09aff5128;hb=f56ceafecc0deae130734dfc0243804f02f46586;hp=2ce62666b684386c0bae79ac63b1c975afd3ea56;hpb=684195f33b11e3067200dd3a9e14304bd7d04463;p=platal.git diff --git a/modules/register.php b/modules/register.php index 2ce6266..c09d68d 100644 --- a/modules/register.php +++ b/modules/register.php @@ -49,16 +49,14 @@ class RegisterModule extends PLModule } if ($hash) { - require_once 'directory.enums.inc.php'; - $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES); $nameTypes = array_flip($nameTypes); $res = XDB::query("SELECT a.uid, pd.promo, pnl.name AS lastname, pnf.name AS firstname, p.xorg_id AS xorgid, p.birthdate_ref AS birthdateRef, FIND_IN_SET('watch', a.flags) AS watch, m.hash FROM register_marketing AS m INNER JOIN accounts AS a ON (m.uid = a.uid) - INNER JOIN account_profiles AS ap ON (a.uid = ap.id AND FIND_IN_SET('owner', ap.perms)) - INNER JOIN profiles AS p ON (p.pid = ap.id) + INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) + INNER JOIN profiles AS p ON (p.pid = ap.uid) INNER JOIN profile_display AS pd ON (p.pid = pd.pid) INNER JOIN profile_name AS pnl ON (p.pid = pnl.pid AND pnl.typeid = {?}) INNER JOIN profile_name AS pnf ON (p.pid = pnf.pid AND pnf.typeid = {?}) @@ -181,7 +179,7 @@ class RegisterModule extends PLModule $subState->set('services', $services); // Validate the password. - if (!Post::v('response2', false)) { + if (!Post::v('pwhash', false)) { $error[] = "Le mot de passe n'est pas valide."; } @@ -199,7 +197,7 @@ class RegisterModule extends PLModule $bannedEmail = true; } } - if ($subState->has('watch')) { + if ($subState->i('watch') != 0) { $alert .= "Inscription d'un utilisateur surveillé - "; } @@ -213,7 +211,7 @@ class RegisterModule extends PLModule $subState->set('birthdate', sprintf("%04d-%02d-%02d", intval($birth[2]), intval($birth[1]), intval($birth[0]))); $subState->set('email', Post::t('email')); - $subState->set('password', Post::t('response2')); + $subState->set('password', Post::t('pwhash')); // Update the current alert if the birthdate is incorrect, // or if the IP address of the user has been banned. @@ -234,7 +232,7 @@ class RegisterModule extends PLModule . " pour nous faire part de cette erreur."; } else { $subState->set('step', 4); - if ($subState->count('backs') >= 3) { + if ($subState->v('backs')->count() >= 3) { $alert .= "Fin d'une inscription hésitante."; } finishRegistration($subState); @@ -250,7 +248,7 @@ class RegisterModule extends PLModule } $page->changeTpl('register/step' . $subState->i('step') . '.tpl'); - $page->addJsLink('motdepasse.js'); + $page->addJsLink('password.js'); if (isset($error)) { $page->trigError($error); } @@ -270,7 +268,6 @@ class RegisterModule extends PLModule return PL_FORBIDDEN; } - require_once 'directory.enums.inc.php'; $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES); $nameTypes = array_flip($nameTypes); @@ -332,7 +329,7 @@ class RegisterModule extends PLModule // XDB::execute("UPDATE accounts SET password = {?}, state = 'active', - registration_date = NOW() + registration_date = NOW(), email = NULL WHERE uid = {?}", $password, $uid); XDB::execute("UPDATE profiles SET birthdate = {?}, last_change = NOW() @@ -398,7 +395,7 @@ class RegisterModule extends PLModule $mymail->send(); // Index the user, to allow her to appear in searches. - Profile::rebuildSearchTokens($uid); + Profile::rebuildSearchTokens($pid); // Notify other users which were watching for her arrival. XDB::execute('REPLACE INTO contacts (uid, contact) @@ -479,6 +476,7 @@ class RegisterModule extends PLModule $mymail->assign('birthdate_ref', $birthdate_ref); $mymail->assign('forlife', $forlife); $mymail->assign('email', $email); + $mymail->assign('logger', S::logger()); if (count($market) > 0) { $mymail->assign('market', implode("\n", $market)); }