register is now quite done
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Tue, 11 Jan 2005 11:08:27 +0000 (11:08 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:24 +0000 (23:27 +0200)
 * send the user on profil.php at the end.
 * the AX directory question is asked at the end too.
 * ability to change the password immediately too.

 * all is now in simple_pages in order to prevent clicks on the menu items

git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-277

htdocs/profil.php
htdocs/register/end.php
htdocs/register/index.php
htdocs/register/success.php [new file with mode: 0644]
include/register.inc.php
templates/register/end.tpl [new file with mode: 0644]
templates/register/success.tpl [new file with mode: 0644]
upgrade/0.9.4/30_auth_user_quick.sql [moved from upgrade/0.9.4/30_melix.sql with 56% similarity]

index 8a4d0f4..5588d93 100644 (file)
@@ -26,6 +26,11 @@ $page->addCssLink('css/profil.css');
 require_once('tabs.inc.php');
 require_once('profil.func.inc.php');
 
+
+if (Post::has('register_from_ax_question')) {
+    $globals->xdb->query('UPDATE auth_user_quick SET profile_from_ax = 1 WHERE user_id = {?}', Session::getInt('uid'));
+}
+
 //on met a jour $opened_tab et $new_tab qui sont le tab du POST et le tab demande
 // Tout d'abord, quel est le tab actuel ?
 // si on vient d'un POST, old_tab etait le tab courant
index 5d75eed..d0f00af 100644 (file)
@@ -20,7 +20,7 @@
  ***************************************************************************/
 
 require_once('xorg.inc.php');
-new_skinned_page('register/end.tpl', AUTH_PUBLIC);
+new_simple_page('register/end.tpl', AUTH_PUBLIC);
 require_once('user.func.inc.php');
 
 if (Env::has('hash')) {
@@ -58,7 +58,7 @@ if ( !Env::has('hash') ||
 
 $globals->xdb->execute('UPDATE  auth_user_md5
                            SET  password={?}, perms="user", date=NOW(), naissance={?}, date_ins = NOW()
-                         WHERE  uid={?}', $password, $naissance, $uid);
+                         WHERE  user_id={?}', $password, $naissance, $uid);
 $globals->xdb->execute('REPLACE INTO auth_user_quick (user_id) VALUES ({?})', $uid);
 $globals->xdb->execute('INSERT INTO aliases (id,alias,type) VALUES ({?}, {?}, "a_vie")', $uid, $forlife);
 $globals->xdb->execute('INSERT INTO aliases (id,alias,type,flags) VALUES ({?}, {?}, "alias", "bestalias")', $uid, $bestalias);
@@ -85,15 +85,16 @@ $mymail->assign('prenom', $prenom);
 $mymail->send();
 
 start_connexion($uid,false);
+$_SESSION['auth'] = AUTH_MDP;
 
 /***********************************************************/
 /************* envoi d'un mail au démarcheur ***************/
 /***********************************************************/
 $res = $globals->xdb->iterRow(
-        "SELECT  DISTINCT sa.alias, sa.nom, sa.prenom
+        "SELECT  DISTINCT sa.alias, s.nom, s.prenom
            FROM  register_marketing AS m
      INNER JOIN  auth_user_md5      AS s  ON ( m.sender = s.user_id )
-     INNER JOIN  aliases            AS sa ON ( a.id = m.sender AND FIND_IN_SET('bestalias', a.flags) )
+     INNER JOIN  aliases            AS sa ON ( sa.id = m.sender AND FIND_IN_SET('bestalias', sa.flags) )
           WHERE  m.uid = {?}", $uid);
 
 while (list($salias, $snom, $sprenom) = $res->next()) {
@@ -115,6 +116,8 @@ while (list($salias, $snom, $sprenom) = $res->next()) {
 
 $globals->xdb->execute("DELETE FROM register_mstats WHERE uid = {?}", $uid);
 
-$page->assign('forlife',$forlife);
+header('Location: success.php');
+$page->assign('uid', $uid);
 $page->run();
+
 ?>
index e84f147..e00452f 100644 (file)
@@ -123,7 +123,7 @@ switch ($sub_state['step']) {
 }
 
 $_SESSION['sub_state'] = $sub_state;
-new_skinned_page('register/step'.intval($sub_state['step']).'.tpl', AUTH_PUBLIC);
+new_simple_page('register/step'.intval($sub_state['step']).'.tpl', AUTH_PUBLIC);
 if (isset($err)) { $page->trig($err); }
 $page->run();
 ?>
diff --git a/htdocs/register/success.php b/htdocs/register/success.php
new file mode 100644 (file)
index 0000000..cefe91b
--- /dev/null
@@ -0,0 +1,44 @@
+<?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_simple_page('register/success.tpl', AUTH_MDP);
+
+if (Env::has('response2'))  {
+    $_SESSION['password'] = $password = Post::get('response2');
+
+    $globals->xdb->execute('UPDATE auth_user_md5 SET password={?} WHERE user_id={?}', $password, Session::getInt('uid'));
+
+    $log =& Session::getMixed('log');
+    $log->log('passwd', '');
+
+    if (Cookie::get('ORGaccess')) {
+        setcookie('ORGaccess', md5($password), (time()+25920000), '/', '' ,0);
+    }
+
+    $page->assign('mdpok', true);
+}
+
+$page->addJsLink('javascript/md5.js');
+$page->addJsLink('javascript/motdepassemd5.js');
+
+$page->run();
+?>
index bb38292..df38f16 100644 (file)
@@ -91,7 +91,7 @@ function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid)
               WHERE  promo={?} AND deces=0 AND perms="pending"', $promo);
 
     while (list($_uid, $_nom, $_prenom, $_mat) = $res->next()) {
-        if (user_cmp($prenon, $nom, $_prenom, $_nom)) {
+        if (user_cmp($prenom, $nom, $_prenom, $_nom)) {
             $ourid  = $_uid;
             $ourmat = $_mat;
             return true;
diff --git a/templates/register/end.tpl b/templates/register/end.tpl
new file mode 100644 (file)
index 0000000..5c8c58c
--- /dev/null
@@ -0,0 +1,31 @@
+{***************************************************************************
+ *  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                *
+ ***************************************************************************}
+
+<h1>:'(</h1>
+
+<p class="erreur">
+Une erreur est survenue lors de ton inscription ...
+</p>
+<p>
+Contacte nous au plus vite, en nous indiquant ce nombre : {$uid} sur 
+<a href="mailto:support@m4x.org">support@m4x.org</a>
+</p>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/register/success.tpl b/templates/register/success.tpl
new file mode 100644 (file)
index 0000000..a29b296
--- /dev/null
@@ -0,0 +1,119 @@
+{***************************************************************************
+ *  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                *
+ ***************************************************************************}
+
+<h1>Bravo !!!</h1>
+
+<p>
+Tu as maintenant accès au site !!!
+Ton adresse électronique à vie <strong>{$forlife}@polytechnique.org</strong> est déjà ouverte, essaie-la !
+</p>
+<p>
+  Remarque: m4x.org est un domaine "discret" qui veut dire "mail for X" et
+  qui comporte exactement les mêmes adresses que le domaine polytechnique.org.
+</p>
+
+
+<h2>Mot de passe</h2>
+
+{if $mdpok}
+
+<p class="erreur">
+ton mot de passe a bien été mis à jour !
+</p>
+
+{else}
+
+<p>
+Tu as recu un mot de passe par défaut, si tu souhaites en changer, tu peux le faire ici :
+</p>
+
+<form action="{$smarty.server.PHP_REQUEST}" method="post" id="changepass">
+  <table class="tinybicol" cellpadding="3" cellspacing="0">
+    <tr>
+      <th colspan="2">
+        Saisie du nouveau mot de passe
+      </th>
+    </tr>
+    <tr>
+      <td class="titre">
+        Nouveau mot de passe :
+      </td>
+      <td>
+        <input type="password" size="10" maxlength="10" name="nouveau" />
+      </td>
+    </tr>
+    <tr>
+      <td class="titre">
+        Retape-le une fois :
+      </td>
+      <td>
+        <input type="password" size="10" maxlength="10" name="nouveau2" />
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2" class="center">
+        <input type="submit" value="Changer" name="submitn" onclick="EnCryptedResponse(); return false;" />
+      </td>
+    </tr>
+  </table>
+</form>
+
+<form action="{$smarty.server.PHP_REQUEST}" method="post" id="changepass2">
+<div><input type="hidden" name="response2"  value="" /></div>
+</form>
+
+<p>
+N'oublie pas : si tu perds ton mot de passe, nous n'avons aucun engagement, en
+particulier en termes de rapidité, mais pas seulement, à te redonner accès au
+site. Cela peut prendre plusieurs semaines, les pertes de mot de passe sont
+traitées avec la priorité minimale.
+</p>
+
+{/if}
+
+<h2>Rejoindre la communauté</h2>
+
+<form action='{rel}/profil.php' method='post'>
+  <p>
+  Pour rejoindre la communauté des X sur le web, nous te convions le plus vivement à remplir ton profil !!!
+  </p>
+
+  <p>
+  Cette fonctionnalités n'est pas du tout redondante avec l'annuaire de l'AX, car nous pouvons synchroniser pour toi
+  les données qu'il contient :
+  </p>
+
+  <ul>
+    <li>
+    tu peux choisir dans ton profil sur Polytechnique.org d'automatiquement transmettre à l'AX (et <strong>uniquement</strong> ces données)
+    des parties de ta fiche, au fur et à mesure que tu les modifies.
+    </li>
+    <li>
+    de même, nous mettons à jour ta fiche depuis les données de l'annuaire de l'AX si tu le souhaites.
+    (si tu ne le souhaite pas, décoche la case ci contre : <input type='checkbox' value='1' checked="checked" name='register_from_ax_question' />)
+    </li>
+  </ul>
+
+  <div class="center">
+    <input type="submit" value="Rejoindre les X sur le Net !" class="erreur" />
+  </div>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
similarity index 56%
rename from upgrade/0.9.4/30_melix.sql
rename to upgrade/0.9.4/30_auth_user_quick.sql
index 79ac536..5e0ccc9 100644 (file)
@@ -1 +1,3 @@
 alter table auth_user_quick add column emails_alias_pub enum('public', 'private') not null default 'private';
+alter table auth_user_quick add column profile_from_ax INT(1) not null default 0;
+