X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister%2Fregister.inc.php;h=e9bd95c1fecfb64d21f9183809fadfaf88965778;hb=955b2f8bc748a959dee2686aa96a3f79ecda082a;hp=4da836be2983566cb356e0e9d9f3eeb0d1fec8a5;hpb=edf5e97934d710662babb5de5dd720519fb12e98;p=platal.git
diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php
index 4da836b..e9bd95c 100644
--- a/modules/register/register.inc.php
+++ b/modules/register/register.inc.php
@@ -1,6 +1,6 @@
i('xorgid')),
- new PFC_Not(new UFC_Dead())
+ new PFC_Not(new UFC_Dead()),
+ new PFC_Not(new UFC_Registered(true))
));
$profile = $uf->getProfile();
-
- if ($profile->__get('state') == 'active') {
+ if (is_null($profile)) {
return "Tu es déjà inscrit ou ton matricule est incorrect !";
}
+
if ($profile->promo() != $subState->s('promo')) {
return 'Le matricule est incorrect.';
}
@@ -131,15 +132,24 @@ function createAliases(&$subState)
$emailXorg = PlUser::makeUserName($subState->t('firstname'), $subState->t('lastname'));
$emailXorg2 = $emailXorg . sprintf(".%02u", ($subState->i('yearpromo') % 100));
- $res = XDB::query("SELECT hruid
+ $res = XDB::query("SELECT hruid, state
FROM accounts
- WHERE uid = {?} AND hruid != ''", $subState->i('uid'));
+ WHERE uid = {?} AND hruid != ''",
+ $subState->i('uid'));
if ($res->numRows() == 0) {
return "Tu n'as pas d'adresse à vie pré-attribuée.
"
- . "Envoie un mail à mail->domain}\">"
+ . "Envoie un mail à mail->domain}\">"
. "support@{$globals->mail->domain} en expliquant ta situation.";
} else {
- $forlife = $res->fetchOneCell();
+ list($forlife, $state) = $res->fetchOneRow();
+ }
+ if ($state == 'active') {
+ return "Tu es déjà inscrit, si tu ne te souviens plus de ton mot de passe d'accès au site, "
+ . "tu peux suivre la procédure de récupération de mot de passe.";
+ } else if ($state == 'disabled') {
+ return "Ton compte a été désactivé par les administrateurs du site suite à des abus. "
+ . "Pour plus d'information ou pour demander la réactivation du compte, tu peux t'adresser à "
+ . "mail->domain}\">support@{$globals->mail->domain}.";
}
$res = XDB::query('SELECT uid, type, expire
@@ -151,10 +161,9 @@ function createAliases(&$subState)
XDB::execute('UPDATE aliases
SET expire = ADDDATE(NOW(), INTERVAL 1 MONTH)
WHERE alias = {?}', $emailXorg);
- XDB::execute('REPLACE INTO homonyms (homonyme_id, uid)
- VALUES ({?}, {?})', $subState->i('uid'), $h_id);
- XDB::execute('REPLACE INTO homonyms (homonyme_id, uid)
- VALUES ({?}, {?})', $h_id, $subState->i('uid'));
+ XDB::execute('INSERT IGNORE INTO homonyms (homonyme_id, uid)
+ VALUES ({?}, {?}), ({?}, {?})',
+ $subState->i('uid'), $h_id, $h_id, $subState->i('uid'));
$res = XDB::query('SELECT alias
FROM aliases
WHERE uid = {?} AND expire IS NULL', $h_id);
@@ -189,9 +198,9 @@ function finishRegistration($subState)
global $globals;
$hash = rand_url_id(12);
- XDB::execute('REPLACE INTO register_pending (uid, forlife, bestalias, mailorg2, password,
- email, date, relance, naissance, hash, services)
- VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})',
+ XDB::execute('INSERT IGNORE INTO register_pending (uid, forlife, bestalias, mailorg2, password,
+ email, date, relance, naissance, hash, services)
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})',
$subState->i('uid'), $subState->s('forlife'), $subState->s('bestalias'),
$subState->s('emailXorg2'), $subState->s('password'), $subState->s('email'),
$subState->s('birthdate'), $hash, implode(',', $subState->v('services')));