begin to work on new registration
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 10 Jan 2005 08:12:30 +0000 (08:12 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:20 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-255

23 files changed:
hooks/tmp.inc.php
htdocs/inscription/index.php [deleted file]
htdocs/inscription/maj.php [deleted file]
htdocs/inscription/step1.php [deleted file]
htdocs/inscription/step2.php [deleted file]
htdocs/inscription/step3.php [deleted file]
htdocs/register/index.php [new file with mode: 0644]
include/register.inc.php [new file with mode: 0644]
templates/docs/contacts.tpl
templates/index.tpl
templates/inscription/error.tpl [deleted file]
templates/inscription/step1a.tpl [deleted file]
templates/inscription/step2.tpl [deleted file]
templates/mails/inscrire.mail.tpl
templates/mails/marketing.relance.tpl
templates/mails/marketing.utilisateur.tpl
templates/password_prompt.tpl
templates/register/step0.tpl [moved from templates/inscription/index.tpl with 79% similarity]
templates/register/step1.tpl [moved from templates/inscription/maj.tpl with 74% similarity]
templates/register/step2.tpl [moved from templates/inscription/step1.tpl with 76% similarity]
templates/register/step3.tpl [new file with mode: 0644]
templates/register/step4.tpl [moved from templates/inscription/step3.tpl with 80% similarity]
upgrade/0.9.4/20_register.sql [new file with mode: 0644]

index 8451ba7..5244f29 100644 (file)
@@ -25,7 +25,7 @@ function tmp_menu()
     $globals->menu->addPrivateEntry(XOM_ADMIN,    20, 'Clear cache',         'clear_all_cache.php');
 
     $globals->menu->addPublicEntry(XOM_US,    00, 'Me connecter !',         'login.php');
-    $globals->menu->addPublicEntry(XOM_US,    10, 'M\'inscrire',            'inscription/');
+    $globals->menu->addPublicEntry(XOM_US,    10, 'M\'inscrire',            'register/');
     $globals->menu->addPublicEntry(XOM_US,    20, 'Pourquoi m\'inscrire ?', 'docs/services.php');
 
     $globals->menu->addPublicEntry(XOM_EXT,   10, 'Associations X',         'http://www.polytechnique.net/');
diff --git a/htdocs/inscription/index.php b/htdocs/inscription/index.php
deleted file mode 100644 (file)
index 70aa5e2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-
-new_skinned_page('inscription/index.tpl', AUTH_PUBLIC);
-$page->run();
-?>
diff --git a/htdocs/inscription/maj.php b/htdocs/inscription/maj.php
deleted file mode 100644 (file)
index 805c186..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-
-if (Env::has('n')) {
-    $res = $globals->xdb->query('SELECT * FROM envoidirect WHERE uid={?}', Env::get('n'));
-    if ($ligne = $res->fetchOneRow()) {
-
-        if (!Env::has('charte')) {
-            new_skinned_page('inscription/step1a.tpl', AUTH_PUBLIC);
-            $page->run();
-        }
-
-        // il faut remettre le matricule dans son format de saisie
-
-        $year = intval(substr($ligne['matricule'],0,4));
-        $rang = intval(substr($ligne['matricule'],4,4));
-        if($year<1996) {
-            $_REQUEST['matricule'] = '';
-        } elseif($year<2000) {
-            $_REQUEST['matricule'] = sprintf('%02u0%03u',$year % 100,$rang);
-        } elseif($year<2100) {
-            $_REQUEST['matricule'] = sprintf('1%02u%03u',$year % 100,$rang);
-        }
-        $_REQUEST['promo']  = $ligne['promo'];
-        $_REQUEST['nom']    = $ligne['nom'];
-        $_REQUEST['prenom'] = $ligne['prenom'];
-        $_REQUEST['email']  = $ligne['email'];
-
-        new_skinned_page('inscription/step2.tpl', AUTH_PUBLIC);
-        require_once("identification.inc.php");
-        require_once("applis.func.inc.php");
-
-        $page->assign('homonyme', $homonyme);
-        $page->assign('forlife',  $forlife);
-        $page->assign('mailorg',  $mailorg);
-        $page->assign('prenom',   $prenom);
-        $page->assign('nom',      $nom);
-
-        $page->assign('envoidirect', Env::get('n'));
-        $page->run();
-    }
-}
-
-new_skinned_page('inscription/maj.tpl', AUTH_PUBLIC);
-$page->run();
-?>
diff --git a/htdocs/inscription/step1.php b/htdocs/inscription/step1.php
deleted file mode 100644 (file)
index 968ca76..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/***************************************************************************
-*  Copyright (C) 2003-2004 Polytechnique.org                              *
-*  http://opensource.polytechnique.org/                                   *
-*                                                                         *
-*  This program is free software; you can redistribute it and/or modify   *
-*  it under the terms of the GNU General Public License as published by   *
-*  the Free Software Foundation; either version 2 of the License, or      *
-*  (at your option) any later version.                                    *
-*                                                                         *
-*  This program is distributed in the hope that it will be useful,        *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
-*  GNU General Public License for more details.                           *
-*                                                                         *
-*  You should have received a copy of the GNU General Public License      *
-*  along with this program; if not, write to the Free Software            *
-*  Foundation, Inc.,                                                      *
-*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
-***************************************************************************/
-
-require_once("xorg.inc.php");
-
-$erreur = Array();
-
-new_skinned_page('inscription/step1.tpl', AUTH_PUBLIC);
-$page->run();
-
-?>
diff --git a/htdocs/inscription/step2.php b/htdocs/inscription/step2.php
deleted file mode 100644 (file)
index dd76160..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-require_once("identification.inc.php");
-
-new_skinned_page('inscription/step2.tpl', AUTH_PUBLIC);
-
-require_once("applis.func.inc.php");
-
-$page->assign('homonyme', $homonyme);
-$page->assign('forlife',  $forlife);
-$page->assign('mailorg',  $mailorg);
-$page->assign('prenom',   $prenom);
-$page->assign('nom',      $nom);
-
-$page->run();
-?>
diff --git a/htdocs/inscription/step3.php b/htdocs/inscription/step3.php
deleted file mode 100644 (file)
index 02033a0..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('inscription/step3.tpl', AUTH_PUBLIC);
-require_once("identification.inc.php");
-
-$page->assign('forlife', $forlife);
-
-if (!isvalid_email(Env::get('email'))) {
-    $page->trig("Le champ 'E-mail' n'est pas valide.");
-}
-
-if (!isvalid_email_redirection(Env::get('email'))) {
-    $page->trig("\"$forlife@polytechnique.org\" doit renvoyer vers un email existant valide.
-            En particulier, il ne peut pas être renvoyé vers lui-même.");
-}
-
-if (!ereg("[0-3][0-9][0-1][0-9][1][9]([0-9]{2})", Env::get('naissance'))) {
-    $page->trig("La 'Date de naissance' n'est pas correcte.
-            Elle est obligatoire pour continuer mais ne sera jamais visible sur le site par la suite.");
-}
-
-if($page->nb_errs()) {
-    $page->changeTpl('inscription/step2.tpl');
-    require_once("applis.func.inc.php");
-    $page->assign('homonyme', $homonyme);
-    $page->assign('mailorg', $mailorg);
-    
-    $page->assign('prenom', $prenom);
-    $page->assign('nom', $nom);
-    
-    $page->run();
-}
-
-$ins_id     = rand_url_id(12);
-$pass_clair = rand_pass();
-$password   = md5($pass_clair);
-$date       = date("Y-m-j");
-
-$birth = sprintf("%s-%s-%s", substr(Env::get('naissance'),4,4),
-        substr(Env::get('naissance'),2,2), substr(Env::get('naissance'),0,2));
-
-// nouvelle inscription
-$globals->xdb->execute(
-        "REPLACE INTO  en_cours (ins_id, password, matricule, promo, nom, prenom, email, naissance, date, nationalite,
-                                 appli_id1, appli_type1, appli_id2, appli_type2, loginbis, username, homonyme)
-               VALUES  ({?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?},{?})"
-        $ins_id, $password, $matricule, $promo, $nom, $prenom, Env::get('email'), $birth,
-        $date, Env::get('nationalite'), Env::get('appli_id1'), Env::get('appli_type1'),
-        Env::get('appli_id2'), Env::get('appli_type2'), $mailorg, $forlife, $homonyme
-);
-$globals->xdb->execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', Env::get('email'), $matricule);
-// si on venait de la page maj.php, on met a jour la table envoidirect
-if (Env::get('envoidirect')) {
-    $globals->xdb->execute('UPDATE envoidirect SET date_succes=NOW() WHERE uid={?}', Env::get('envoidirect'));
-}
-
-require_once('xorg.mailer.inc.php');
-$mymail = new XOrgMailer('inscrire.mail.tpl');
-$mymail->assign('mailorg', $mailorg);
-$mymail->assign('lemail', Env::get('email'));
-$mymail->assign('pass_clair', $pass_clair);
-$mymail->assign('baseurl', $globals->baseurl);
-$mymail->assign('ins_id', $ins_id);
-$mymail->assign('subj', $mailorg."@polytechnique.org");
-$mymail->send();
-
-$page->run();
-?>
diff --git a/htdocs/register/index.php b/htdocs/register/index.php
new file mode 100644 (file)
index 0000000..a97be21
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+require_once('xorg.inc.php');
+
+$sub_state = Session::getMixed('sub_state', Array());
+if (!isset($sub_state['step'])) {
+    $sub_state['step'] = 0;
+}
+if (Get::has('back') && Get::getInt('back') < $sub_state['step']) {
+    $sub_state['step'] = max(0,Get::getInt('back'));
+}
+
+switch ($sub_state['step']) {
+    case 0:
+        if (Post::has('step1')) { $sub_state['step'] = 1; }
+        break;
+
+    case 1:
+        if (Post::has('promo')) {
+            $promo = Post::getInt('promo');
+            if ($promo < 1900 || $promo > date('Y')) {
+                $err = "La promotion saisie est incorrecte !";
+            } else {
+                $sub_state['step']  = 2;
+                $sub_state['promo'] = $promo;
+                if ($promo >= 1996 && $promo<2000) {
+                    $sub_state['mat'] = ($promo % 100)*10 . '???';
+                } elseif($promo >= 2000) {
+                    $sub_state['mat'] = 100 + ($promo % 100) . '???';
+                }
+            }
+        }
+        break;
+
+    case 2:
+        if (count($_POST)) {
+            require_once('register.inc.php');
+            $sub_state['prenom'] = Post::get('prenom');
+            $sub_state['nom']    = Post::get('nom');
+            $sub_state['mat']    = Post::get('mat');
+            $err = check_new_user($sub_state);
+
+            if ($err !== true) { break; }
+            $err = create_aliases($sub_state);
+            if ($err === true) {
+                unset($err);
+                $sub_state['step'] = 3;
+            }
+        }
+        break;
+    
+    case 3:
+        if (count($_POST)) {
+            require_once('register.inc.php');
+            if (!isvalid_email(Post::get('email'))) {
+                $err[] = "Le champ 'E-mail' n'est pas valide.";
+            } elseif (!isvalid_email_redirection(Post::get('email'))) {
+                $err[] = $sub_state['forlife']." doit renvoyer vers un email existant ".
+                    "valide, en particulier, il ne peut pas être renvoyé vers lui-même.";
+            }
+            if (!preg_match('/^[0-3][0-9][01][0-9][12][90][0-9][0-9]$/', Post::get('naissance'))) {
+                $err[] = "La 'Date de naissance' n'est pas correcte.";
+            }
+
+            if (isset($err)) {
+                $err = join('<br />', $err);
+            } else {
+                $birth = sprintf("%s-%s-%s", substr(Env::get('naissance'),4,4),
+                        substr(Env::get('naissance'),2,2), substr(Env::get('naissance'),0,2));
+                $sub_state['step']      = 4;
+                $sub_state['email']     = Post::get('email');
+                $sub_state['naissance'] = $birth;
+                finish_ins($sub_state);
+            }
+        }
+        break;
+}
+
+$_SESSION['sub_state'] = $sub_state;
+new_skinned_page('register/step'.intval($sub_state['step']).'.tpl', AUTH_PUBLIC);
+if (isset($err)) { $page->trig($err); }
+$page->run();
+?>
diff --git a/include/register.inc.php b/include/register.inc.php
new file mode 100644 (file)
index 0000000..3b7bcd3
--- /dev/null
@@ -0,0 +1,236 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+require_once 'xorg.misc.inc.php';
+
+// {{{ function user_cmp
+
+function user_cmp($prenom, $nom, $_prenom, $_nom)
+{
+    $_nom    = strtoupper(replace_accent($_nom));
+    $_prenom = strtoupper(replace_accent($_prenom));
+    $nom     = strtoupper(replace_accent($nom));
+    $prenom  = strtoupper(replace_accent($prenom));
+
+    $is_ok   = strtoupper($_prenom) == strtoupper($prenom);
+    
+    $tokens  = preg_split("/[ \-']/", $nom, -1, PREG_SPLIT_NO_EMPTY);
+    $maxlen  = 0;
+
+    foreach ($tokens as $str) {
+        $is_ok &= strpos($_nom, $str)!==false;
+        $maxlen = max($maxlen, strlen($str));
+    }
+
+    return $is_ok && ($maxlen > 2 || $maxlen == strlen($_nom));
+}
+
+// }}}
+// {{{ function check_mat
+
+function check_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid)
+{
+    global $globals;
+    if (!preg_match('/^[0-9][0-9][0-9][0-9][0-9][0-9]$/', $mat)) {
+        return "Le matricule doit comporter 6 chiffres.";
+    }
+
+    $year = intval(substr($mat, 0, 3));
+    $rang = intval(substr($mat, 3, 3));
+    if ($year > 200) { $year /= 10; };
+    if ($year < 96) {
+        return "ton matricule est incorrect";
+    } else {
+        $ourmat = sprintf('%04u%04u', 1900+$year, $rang);
+    }
+
+    $res = $globals->xdb->query(
+            'SELECT  user_id, promo, perms IN ("admin","user"), nom, prenom 
+              FROM  auth_user_md5
+             WHERE  matricule={?} and deces = 0', $ourmat);
+    list ($uid, $_promo, $_already, $_nom, $_prenom) = $res->fetchOneRow();
+    if ($_already) { return "tu es déjà inscrit ou ton matricule est incorrect !"; }
+    if ($_promo != $promo) { return "erreur de matricule"; }
+
+    if (!user_cmp($prenom, $nom, $_prenom, $_nom)) {
+        return "erreur dans l'identification.  Réessaie, il y a une erreur quelque part !";
+    }
+
+    $ourid = $uid;
+    return true;
+}
+
+// }}}
+// {{{ function check_old_mat
+
+function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid)
+{
+    global $globals;
+
+    $res = $globals->xdb->iterRow(
+            'SELECT  user_id, nom, prenom, matricule
+               FROM  auth_user_md5
+              WHERE  promo={?} AND deces=0 AND perms="pending"', $promo);
+
+    while (list($_uid, $_nom, $_prenom, $_mat) = $res->next()) {
+        if (user_cmp($prenon, $nom, $_prenom, $_nom)) {
+            $ourid  = $_uid;
+            $ourmat = $_mat;
+            return true;
+        }
+    }
+
+    return "erreur dans l'identification.  Réessaie, il y a une erreur quelque part !";
+}
+
+// }}}
+// {{{ function check_new_user
+
+function check_new_user(&$sub)
+{
+    global $globals;
+    extract($sub);
+
+    $prenom  = preg_replace("/[ \t]+/", ' ', trim($prenom));
+    $prenom  = make_firstname_case($prenom);
+
+    $nom     = preg_replace("/[ \t]+/", ' ', trim($nom));
+    $nom     = strtoupper(replace_accent($nom));
+
+    if ($promo >= 1996) {
+        $res = check_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid);
+    } else {
+        $res = check_old_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid);
+    }
+    if ($res !== true) { return $res; }
+
+    $sub['nom']    = $nom;
+    $sub['prenom'] = $prenom;
+    $sub['ourmat'] = $ourmat;
+    $sub['uid']    = $ourid;
+
+    return true;
+}
+
+// }}}
+// {{{ function create_aliases
+
+function create_aliases (&$sub)
+{
+    global $globals;
+    extract ($sub);
+
+    $mailorg  = make_username($prenom, $nom);
+    $mailorg2 = sprintf("%02u", ($promo%100));
+    $forlife  = make_forlife($prenom, $nom, $promo);
+    /*****************************************************************************/
+    /***************************** IDENTIFICATION OK *****************************/
+    /*****************************************************************************/
+
+    $res      = $globals->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.<br />".
+            "envoie un mail à <a href=\"mailto:support@polytechnique.org\">support@polytechnique.org</a> en expliquant ta situation.";
+    }
+    
+    $res      = $globals->xdb->query('SELECT id, type, expire FROM aliases WHERE alias={?}', $forlife);
+
+    if ( $res->numRows() ) {
+
+        list($h_id, $h_type, $expire) = $res->fetchOneRow();
+        $res->free();
+
+        if ( $h_type != 'homonyme' and empty($expire) ) {
+            $globals->xdb->execute('UPDATE aliases SET expire=ADDDATE(NOW(),INTERVAL 1 MONTH) WHERE alias={?}', $mailorg);
+            $globals->xdb->execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $h_id);
+            $globals->xdb->execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $uid);
+            $res = $globals->xdb->query("SELECT alias FROM aliases WHERE id={?}", $h_id);
+            $als = $res->fetchColumn();
+
+            require_once('diogenes/diogenes.hermes.inc.php');
+            $mailer = new HermesMailer();
+            $mailer->setFrom('"Support Polytechnique.org" <support@polytechnique.org>');
+            $mailer->addTo("$mailorg@polytechnique.org");
+            $mailer->setSubject("perte de ton alias $mailorg dans un mois !");
+            $mailer->addCc('"Support Polytechnique.org" <support@polytechnique.org>');
+            $msg =
+                "Un homonyme s'est inscrit, nous ne pouvons donc garder ton alias '$mailorg'.\n\n".
+                "Tu gardes tout de même l'usage de cet alias pour un mois encore à compter de ce jour.\n\n".
+                "Lorsque cet alias sera désactivé, l'adresse :\n".
+                "    $mailorg@polytechnique.org\n".
+                "renverra vers un robot qui indique qu'il y a plusieurs personnes portant le même nom ;\n".
+                "cela évite que l'un des homonymes reçoive des courriels destinés à l'autre.\n\n".
+                "Pour te connecter au site, tu pourras utiliser comme identifiant n'importe lequel de tes autres alias :\n".
+                "    ".join(', ', $als)."\n";
+                "Commence dès aujourd'hui à communiquer à tes correspondants la nouvelle adresse que tu comptes utiliser !\n\n".
+                "En nous excusant pour le désagrément occasionné,\n".
+                "cordialement,\n".
+                "-- \n".
+                "L'équipe de Polytechnique.org\n".
+                "\"Le portail des élèves & anciens élèves de l'X\"";
+            $mailer->SetTxtBody(wordwrap($msg,72));
+            $mailer->send();
+        }
+
+        $sub['forlife']   = $forlife;
+        $sub['bestalias'] = $mailorg2;
+        $sub['mailorg2']  = null;
+    } else {
+        $sub['forlife']   = $forlife;
+        $sub['bestalias'] = $mailorg;
+        $sub['mailorg2']  = $mailorg2;
+    }
+
+    return true;
+}
+
+// }}}
+// {{{ function finish_ins
+
+function finish_ins($sub_state)
+{
+    global $globals;
+    extract($sub_state);
+
+    $pass     = rand_pass();
+    $pass_md5 = md5($pass_clair);
+    $hash     = rand_url_id(12);
+  
+    $globals->xdb->execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat);
+
+    $globals->xdb->execute(
+            "REPLACE INTO  register_pending (uid, forlife, bestalias, mailorg2, password, email, date, relance, naissance, hash)
+                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?})",
+            $uid, $forlife, $bestalias, $mailorg2, $pass_md5, $email, $naissance, $hash);
+
+    require_once('xorg.mailer.inc.php');
+    $mymail = new XOrgMailer('inscrire.mail.tpl');
+    $mymail->assign('mailorg', $bestalias);
+    $mymail->assign('lemail',  $email);
+    $mymail->assign('pass',    $pass);
+    $mymail->assign('baseurl', $globals->baseurl);
+    $mymail->assign('hash',    $hash);
+    $mymail->assign('subj',    $bestalias."@polytechnique.org");
+    $mymail->send();
+}
+
+// }}}
+?>
index 7197591..9f53e74 100644 (file)
@@ -71,7 +71,7 @@ Cel
   Je n'arrive pas à m'inscrire sur le site
 </h1>
 <p>
-L'inscription se déroule en <a href="{"inscription/"|url}">une étape sur notre site web</a>,
+L'inscription se déroule en <a href="{rel}/register/">une étape sur notre site web</a>,
 suivie d'une étape de confirmation basée sur l'e-mail que tu as donné.
 </p>
 <p>
index 3b12f7c..dd0a975 100644 (file)
@@ -36,7 +36,7 @@
   </ul>
   <strong>Si vous êtes polytechnicien,</strong>
   <ul>
-   <li class="spaced">vous pouvez <strong><a href="/inscription/">vous inscrire à Polytechnique.org</a></strong> si ce n'est pas encore fait,</li>
+   <li class="spaced">vous pouvez <strong><a href="/register/">vous inscrire à Polytechnique.org</a></strong> si ce n'est pas encore fait,</li>
    <li class="spaced">ou <strong><a href="login.php">vous connecter</a></strong> si vous êtes inscrit !</li>
   </ul>
    Vous pouvez <strong><a href="docs/services.php">consulter la liste de ce que vous apporte Polytechnique.org</a></strong> si vous hésitez à vous inscrire !
diff --git a/templates/inscription/error.tpl b/templates/inscription/error.tpl
deleted file mode 100644 (file)
index cf98809..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
-
-
-{$html|smarty:nodefaults}
-
-
-{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/inscription/step1a.tpl b/templates/inscription/step1a.tpl
deleted file mode 100644 (file)
index 305afc2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
-
-
-<form action="{$smarty.server.REQUEST_URI}" method="post">
-  <h1>
-    Conditions générales
-  </h1>
-  <p>
-  L'enregistrement se déroule <strong>en deux étapes</strong>. La pré-inscription te prendra moins
-  de 5 minutes. La seconde étape est une phase de validation où c'est nous qui te
-  recontactons pour te fournir un mot de passe et te demander de le changer.
-  </p>
-  {include file="docs/charte.tpl"}
-  <div class="center">
-    <input type='hidden' name='charte' value='OK' />
-    <input type="submit" value="J'accepte ces conditions" name="submit" />
-  </div>
-</form>
-
-
-{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/inscription/step2.tpl b/templates/inscription/step2.tpl
deleted file mode 100644 (file)
index 132a822..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
-
-
-{include file="applis.js.tpl"}
-
-<h1>
-  Formulaire de pré-inscription
-</h1>
-
-
-<form action="{"inscription/step3.php"|url}" method="post">
-  {if $homonyme}
-  <p>
-  Tu as déjà un homonyme inscrit dans notre base de données mais dans une autre promotion, nous allons
-  donc te donner l'adresse <strong>{$mailorg}@polytechnique.org</strong>, en plus
-  de ton adresse à vie <strong>{$forlife}@polytechnique.org</strong>.
-  </p>
-  {else}
-  <p>
-  Tu n'as pour le moment aucun homonyme dans notre base de données, nous allons
-  donc te donner l'adresse <strong>{$mailorg}@polytechnique.org</strong>, en plus
-  de ton adresse à vie <strong>{$forlife}@polytechnique.org</strong>.
-  Sache que tu peux perdre l'adresse <strong>{$mailorg}@polytechnique.org</strong> 
-  si un homonyme s'inscrit (même si cela reste assez rare).
-  </p>
-  {/if}
-  
-  <p>
-  Elle pointera sur les e-mails de ton choix, indique-s-en un pour commencer
-  (tu pourras indiquer les autres une fois l'inscription terminée).
-  Attention, il doit <strong>impérativement être correct</strong> pour que nous puissions 
-  t'envoyer ton mot de passe.
-  </p>
-  <table class="bicol" cellpadding="3" cellspacing="0" summary="Préinscription">
-    <tr>
-      <th colspan="2">
-        Contact et sécurité
-      </th>
-    </tr>
-    <tr>
-      <td class="titre">
-        E-mail<br />
-        <span class="smaller">(Première redirection)</span>
-      </td>
-      <td>
-        <input type="text" size="35" maxlength="50" name="email" value="{$smarty.request.email}" />
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">
-        Date de naissance<br />
-        <span class="smaller">(Format JJMMAAAA)</span>
-      </td>
-      <td>
-        <input type="text" size="8" maxlength="8" name="naissance"  value="{$smarty.request.naissance}" />
-        (demandée si perte de mot de passe)
-      </td>
-    </tr>
-    <tr>
-      <th colspan="2">
-        Fiche personnelle
-      </th>
-    </tr>
-    <tr>
-      <td class="titre">
-        Identité
-      </td>
-      <td>
-        {$prenom} {$nom}, X{$smarty.request.promo}
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">
-        Nom de mariage
-      </td>
-      <td>
-        Si ton nom de mariage est différent de {$nom}, tu pourras le préciser dans
-        ton profil une fois que tu auras confirmé ton inscription.
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">
-        Nationalité
-      </td>
-      <td>
-        <select name="nationalite">
-          {select_nat valeur=$smarty.request.nationalite}
-        </select>
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">
-        Appli graduate
-      </td>
-      <td>
-        <select name="appli_id1" onchange="fillType(this.form.appli_type1, this.selectedIndex-1);">
-          {applis_options selected=$smarty.request.appli_id1}
-        </select>
-        <br />
-        <select name="appli_type1">
-          <option value=""></option>
-        </select>
-        <script type="text/javascript">
-          <!--        
-          fillType(document.infos.appli_type1, document.infos.appli_id1.selectedIndex-1);
-          selectType(document.infos.appli_type1, '{$smarty.request.appli_type1}');
-          //-->       
-        </script>
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">
-        Post-graduate
-      </td>
-      <td>
-        <select name="appli_id2" onchange="fillType(this.form.appli_type2, this.selectedIndex-1);">
-          {applis_options selected=$smarty.request.appli_id2}
-        </select>
-        <br />
-        <select name="appli_type2">
-          <option value=""></option>
-        </select>
-        <script type="text/javascript">
-          <!--        
-          fillType(document.infos.appli_type2, document.infos.appli_id2.selectedIndex-1);
-          selectType(document.infos.appli_type2, '{$smarty.request.appli_type2}');
-          //-->       
-        </script>
-      </td>
-    </tr>
-    <tr>
-      <td colspan="2" class="center">
-        <input type="hidden" value="{$envoidirect|default:$smarty.request.envoidirect}" name="envoidirect" />
-        <input type="hidden" value="{$smarty.request.nom}" name="nom" />
-        <input type="hidden" value="{$smarty.request.prenom}" name="prenom" />
-        <input type="hidden" value="{$smarty.request.promo}" name="promo" />
-        <input type="hidden" value="{$smarty.request.matricule}" name="matricule" />
-        <input type="submit" value="Terminer la pré-inscription" name="submit" />
-      </td>
-    </tr>
-  </table>
-</form>
-
-
-{* vim:set et sw=2 sts=2 sws=2: *}
index 22c0415..3c06390 100644 (file)
@@ -29,11 +29,11 @@ Ton inscription sur Polytechnique.org est presque termin
 Après activation, tes paramètres seront :
 
 login        : {$mailorg}
-mot de passe : {$pass_clair}
+mot de passe : {$pass}
 
 Rends-toi sur la page web suivante afin d'activer ta pré-inscription, et de changer ton mot de passe en quelque chose de plus facile à mémoriser :
 
-{$baseurl}/inscription/step4.php?ref={$ins_id}
+{$baseurl}/register/end.php?hash={$hash}
 
 Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur.
 
index a3f6ac3..ac23336 100644 (file)
@@ -37,7 +37,7 @@ mot de passe : {$nveau_pass}
 
 Rends-toi sur la page web suivante afin d'activer ta pré-inscription, et de changer ton mot de passe en quelque chose de plus facile à mémoriser :
 
-{$baseurl}/inscription/step4.php?ref={$lins_id}
+{$baseurl}/register/end.php?hash={$lins_id}
 
 Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur.
 
index 92f347b..00e767a 100644 (file)
@@ -30,7 +30,7 @@ Cher camarade,
 Ta fiche n'est pas à jour dans l'annuaire des Polytechniciens sur Internet. Pour la mettre à jour, il te suffit de visiter cette page ou de copier cette adresse dans la barre de ton navigateur :
 
 ==========================================================
-{$baseurl}/inscription/maj.php?n={$user_id}
+{$baseurl}/register/maj.php?n={$user_id}
 ==========================================================
 
 Il ne te faut que 5 minutes sur http://www.polytechnique.org/ pour rejoindre les {$num_users} camarades branchés grâce au système de reroutage de l'X et qui permet de joindre un camarade en connaissant seulement son nom et son prénom... et de bénéficier pour la vie d'une adresse prestigieuse {$mailorg}@polytechnique.org et son alias discret {$mailorg}@m4x.org (m4x = mail for X).
index e7ab668..8d06f56 100644 (file)
@@ -35,7 +35,7 @@
 <p>
 <strong>Merci de rentrer ton mot de passe pour démarrer une connexion au site.</strong>
 Si tu n'es pas {insert name="getName"}, change le login ci-dessous, ou rends-toi sur
-<a href="{rel}/inscription/">la page d'inscription</a>.
+<a href="{rel}/register/">la page d'inscription</a>.
 </p>
 {/min_auth}
 
@@ -52,7 +52,7 @@ Si tu n'es pas {insert name="getName"}, change le login ci-dessous, ou rends-toi
   Si tu n'es jamais venu sur le site, <strong>il faut t'enregistrer auprès de
     nous</strong> pour obtenir un accès. Polytechnique.org c'est l'e-mail des X,
   l'annuaire en ligne, plus un tas d'autres services.  Nous te fournirons un accès le plus
-  rapidement possible. <strong> <a href="{rel}inscription/">Clique ici pour nous demander tes
+  rapidement possible. <strong> <a href="{rel}/register/">Clique ici pour nous demander tes
       paramètres personnels.</a></strong>
   </li>
 </ul>
similarity index 79%
rename from templates/inscription/index.tpl
rename to templates/register/step0.tpl
index 58c57ca..891a08a 100644 (file)
  ***************************************************************************}
 
 
-<form action="{"inscription/step1.php"|url}" method="post">
-  <h1>
-    Conditions générales
-  </h1>
-  <p>
-  L'enregistrement se déroule <strong>en deux étapes</strong>. La pré-inscription te prendra moins
-  de 5 minutes. La seconde étape est une phase de validation où c'est nous qui te
-  recontactons pour te fournir un mot de passe et te demander de le changer.
-  </p>
-  {include file="docs/charte.tpl"}
+<h1>Conditions générales</h1>
+
+<p>
+L'enregistrement se déroule <strong>en deux étapes</strong> :
+</p>
+<ul>
+  <li>
+  la pré-inscription quit te prendra moins de 5 minutes ;
+  </li>
+  <li>
+  suivi d'un envoi d'un mail de notre part (immédiat !) qui te permettra
+  de te connecter au site !
+  </li>
+</ul>
+
+{include file="docs/charte.tpl"}
+
+<form action="?" method="post">
   <div class="center">
-    <input type="submit" value="J'accepte ces conditions" name="submit" />
+    <input type="submit" value="J'accepte ces conditions" name="step1" />
   </div>
 </form>
 
similarity index 74%
rename from templates/inscription/maj.tpl
rename to templates/register/step1.tpl
index 3a6fd5c..c7fe719 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************}
 
+<h1>Identification</h1>
 
-<p>
-Cette page n'existe pas ou plus. Tu as peut-être déjà cliqué une fois, l'adresse
-envoyée par e-mail n'est valable qu'une seule fois. Le plus simple est d'aller à
-la page d'enregistrement <a href="/inscription/"><strong>en cliquant sur ce lien.</strong></a>
-</p>
-<p>
-A la fin de l'enregistrement, tu obtiendras <strong>login et mot de passe</strong> pour
-modifier ta fiche dans l'annuaire on-line.
-</p>
+<form action="?" method="post">
+  <p>
+    Avant toute chose, il te faut nous donner ta promotion :
+  </p>
+  <table class="tinybicol">
+    <tr>
+      <th>
+        Promotion
+      </th>
+    </tr>
+    <tr>
+      <td>
+        Donne ta promotion sur 4 chiffres : 
+        <input type="text" size="4" maxlength="4" name="promo" value="{$smarty.post.promo}" />
+      </td>
+    </tr>
+    <tr>
+      <td class="center">
+        <input type="submit" value="Valider" />
+      </td>
+    </tr>
+  </table>
+</form>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
similarity index 76%
rename from templates/inscription/step1.tpl
rename to templates/register/step2.tpl
index 99d460b..2c8a46f 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************}
 
+<h1>Identification</h1>
 
-<form action="{"inscription/step2.php"|url}" method="post" id='idf'>
-  <h1>
-    Identification
-  </h1>
-  <p>
-    Renseigne tes nom, prénom et promotion, et si tu es d'une promotion
-    postérieure à la 1996, ton numéro de matricule.
-  </p>
+<p>
+<a href="?back=1">retour</a>
+</p>
+
+<form action="?" method="post">
   <table class="bicol" summary="Identification" cellpadding="3">
+    {if $smarty.session.sub_state.promo >= 1996}
     <tr>
-      <th>
-        Promo &lt; 1996
-      </th>
-      <th>
-        Promo depuis 1996
-      </th>
+      <th colspan="2">matricule</th>
     </tr>
     <tr>
+      <td class="titre">
+        Matricule X :
+      </td>
       <td>
-        Le numéro d'identification n'est pas nécessaire pour 
-        l'inscription pour les promotions jusqu'à 1995 incluse.
+        <input type="text" size="6" maxlength="6" name="mat" 
+          value="{$smarty.request.matricule|default:$smarty.session.sub_state.mat}" />
       </td>
+    </tr>
+    <tr class="pair">
+      <td></td>
       <td>
-        <strong>Matricule X :</strong>&nbsp;&nbsp;
-        <input type="text" size="6" maxlength="6" name="matricule" value="{$smarty.request.matricule}" />
-        <br />
-        6 chiffres terminant par le numéro d'entrée<br />
-        (ex: 960532 ou 100532)<br />
+        6 chiffres terminant par le numéro d'entrée (ex: 960532 ou 101532)<br />
         Voir sur le GU ou un bulletin de solde pour trouver cette information<br /><br />
         Pour les élèves étrangers voie 2, il est du type :<br />
         Promotion: 1995, Matricule: 960XXX - Promotion: 2001, Matricule 102XXX.
       </td>
     </tr>
+    {/if}
     <tr>
       <th colspan="2">
         Identification
@@ -79,7 +76,7 @@
         Promotion
       </td>
       <td>
-        <input type="text" size="4" maxlength="4" name="promo" value="{$smarty.request.promo}" />
+        <input type="text" size="4" readonly="readonly" value="{$smarty.session.sub_state.promo}" />
       </td>
     </tr>
     <tr>
diff --git a/templates/register/step3.tpl b/templates/register/step3.tpl
new file mode 100644 (file)
index 0000000..d4e2099
--- /dev/null
@@ -0,0 +1,88 @@
+{***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************}
+
+
+{if $smarty.session.sub_state.forlife}
+
+<h1>Formulaire de pré-inscription</h1>
+
+<form action="?" method="post">
+  {if $smarty.session.sub_state.mailorg2}
+  <p>
+  Tu n'as pour le moment aucun homonyme dans notre base de données, nous allons
+  donc te donner l'adresse <strong>{$smarty.session.sub_state.bestalias}@polytechnique.org</strong>,
+  en plus de ton adresse à vie <strong>{$smarty.session.sub_state.forlife}@polytechnique.org</strong>.
+  Sache que tu peux perdre l'adresse <strong>{$smarty.session.sub_state.bestalias}@polytechnique.org</strong> 
+  si un homonyme s'inscrit (même si cela reste assez rare).
+  </p>
+  {else}
+  <p>
+  Tu as déjà un homonyme inscrit dans notre base de données mais dans une autre promotion, nous allons
+  donc te donner l'adresse <strong>{$smarty.session.sub_state.bestalias}@polytechnique.org</strong>, en plus
+  de ton adresse à vie <strong>{$smarty.session.sub_state.forlife}@polytechnique.org</strong>.
+  </p>
+  {/if}
+  
+  <p>
+  Ces adresses sont des redirections vers des adresses e-mail de ton choix.
+  Indique-s-en un pour commencer (tu pourras indiquer les autres une fois l'inscription terminée) et pouvoir
+  terminer ton inscription.
+  </p>
+  <p>
+  Attention, il doit <strong>impérativement être correct</strong> pour que nous puissions 
+  t'envoyer ton mot de passe.
+  </p>
+
+  <table class="bicol">
+    <tr>
+      <th colspan="2">
+        Contact et sécurité
+      </th>
+    </tr>
+    <tr>
+      <td class="titre">
+        E-mail<br />
+        <span class="smaller">(Première redirection)</span>
+      </td>
+      <td>
+        <input type="text" size="35" maxlength="50" name="email" value="{$smarty.post.email}" />
+      </td>
+    </tr>
+    <tr>
+      <td class="titre">
+        Date de naissance<br />
+        <span class="smaller">(Format JJMMAAAA)</span>
+      </td>
+      <td>
+        <input type="text" size="8" maxlength="8" name="naissance"  value="{$smarty.post.naissance}" />
+        (demandée si perte de mot de passe)
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2" class="center">
+        <input type="submit" value="Terminer la pré-inscription" />
+      </td>
+    </tr>
+  </table>
+</form>
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
similarity index 80%
rename from templates/inscription/step3.tpl
rename to templates/register/step4.tpl
index 3fd8d87..dbac7ae 100644 (file)
  ***************************************************************************}
 
 
-<h1>
-  Pré-inscription réussie
-</h1>
+<h1>Pré-inscription réussie</h1>
 
 <p>
 La pré-inscription que tu viens de soumettre a été enregistrée.
 </p>
 <p>
 Les instructions te permettant notamment d'activer ton e-mail
-<strong>{$forlife}@polytechnique.org</strong>, ainsi que ton mot de passe pour
-acc&eacute;der au site viennent de t'être envoyés à l'adresse
-<strong>{$smarty.request.email}</strong>.
+<strong>{$smarty.session.sub_state.forlife}@polytechnique.org</strong>, ainsi que ton mot de passe pour
+accéder au site viennent de t'être envoyés à l'adresse <strong>{$smarty.session.sub_state.email}</strong>.
 </p>
 <p>
 Tu n'as que quelques jours pour suivre ces instructions après quoi la pré-inscription
-est effacée automatiquement de nos bases et il faut tout recommencer. Si tu as soumis
-plusieurs pré-inscriptions, seul le dernier e-mail reçu est valable, les précédents
-ne servant plus.
+est effacée automatiquement de nos bases et il faut tout recommencer.
 </p>
 <p>
-Si tu ne reçois rien, vérifie bien l'adresse <strong>{$smarty.request.email}</strong>.
+Si tu ne reçois rien, vérifie bien l'adresse <strong>{$smarty.session.sub_state.email}</strong>.
 </p>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/upgrade/0.9.4/20_register.sql b/upgrade/0.9.4/20_register.sql
new file mode 100644 (file)
index 0000000..0fbc85d
--- /dev/null
@@ -0,0 +1,23 @@
+-- MySQL dump 9.11
+
+--
+-- Table structure for table register_pending
+--
+
+CREATE TABLE register_pending (
+  uid        varchar(32)  NOT NULL default '',
+  forlife    varchar(255) NOT NULL default '',
+  bestalias  varchar(255) NOT NULL default '',
+  mailorg2   varchar(255)          default null,
+  password   varchar(32)  NOT NULL default '',
+  email      varchar(255) NOT NULL default '',
+  date       date         NOT NULL default '0000-00-00',
+  relance    date         NOT NULL default '0000-00-00',
+  naissance  date         NOT NULL default '0000-00-00',
+  hash       varchar(12)  NOT NULL default '',
+  PRIMARY KEY (uid),
+  UNIQUE KEY  (forlife),
+  UNIQUE KEY  (bestalias),
+  INDEX       (hash)
+);
+