X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister%2Fregister.inc.php;h=9bc05b4067200d37e7acc6bc258c87b1f72483b4;hb=efe597c5795234724bc3df508bd628f9860a9c32;hp=4839e3614ddefb9de0fd17c0c7c410f556148baf;hpb=55546c0db778c2d8f9d7debd30117931dc39ff16;p=platal.git diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index 4839e36..9bc05b4 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -149,24 +149,24 @@ function create_aliases (&$sub) global $globals; extract ($sub); - $mailorg = make_username($prenom, $nom); + $mailorg = make_username($prenom, $nom); $mailorg2 = $mailorg.sprintf(".%02u", ($promo%100)); - $forlife = make_forlife($prenom, $nom, $promo); - $res = XDB::query('SELECT COUNT(*) FROM aliases WHERE alias={?}', $forlife); - if ($res->fetchOneCell() > 0) { - return "Tu as un homonyme dans ta promo, il faut traiter ce cas manuellement.
". - "envoie un mail à mail->domain}\">" . - "support@{$globals->mail->domain} en expliquant ta situation."; + $res = XDB::query("SELECT hruid FROM auth_user_md5 WHERE user_id = {?}", $uid); + if ($res->numRows() == 0) { + return "Tu n'as pas d'adresse à vie pré-attribuée.
" + . "Envoie un mail à mail->domain}\">" + . "support@{$globals->mail->domain} en expliquant ta situation."; + } else { + // TODO: at the moment forlife == hruid, however we'll have to change + // that behaviour when masters will be on plat/al. + $forlife = $res->fetchOneCell(); } - $res = XDB::query('SELECT id, type, expire FROM aliases WHERE alias={?}', $mailorg); - - if ( $res->numRows() ) { - + $res = XDB::query('SELECT id, type, expire FROM aliases WHERE alias={?}', $mailorg); + if ($res->numRows()) { list($h_id, $h_type, $expire) = $res->fetchOneRow(); - - if ( $h_type != 'homonyme' and empty($expire) ) { + if ($h_type != 'homonyme' and empty($expire)) { XDB::execute('UPDATE aliases SET expire=ADDDATE(NOW(),INTERVAL 1 MONTH) WHERE alias={?}', $mailorg); XDB::execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $h_id); XDB::execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $uid); @@ -225,10 +225,9 @@ function finish_ins($sub_state) { global $globals; extract($sub_state); - require_once('secure_hash.inc.php'); $pass = rand_pass(); - $pass_encrypted = hash_encrypt($pass); + $pass_encrypted = sha1($pass); $hash = rand_url_id(12); XDB::execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat);