From 1e24a03ccaa3e780a6a414237f70f02687c58e10 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Tue, 11 Jan 2005 11:08:27 +0000 Subject: [PATCH] register is now quite done * 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 | 5 + htdocs/register/end.php | 13 ++- htdocs/register/index.php | 2 +- htdocs/register/success.php | 44 ++++++++ include/register.inc.php | 2 +- templates/register/end.tpl | 31 ++++++ templates/register/success.tpl | 119 +++++++++++++++++++++ .../0.9.4/{30_melix.sql => 30_auth_user_quick.sql} | 2 + 8 files changed, 211 insertions(+), 7 deletions(-) create mode 100644 htdocs/register/success.php create mode 100644 templates/register/end.tpl create mode 100644 templates/register/success.tpl rename upgrade/0.9.4/{30_melix.sql => 30_auth_user_quick.sql} (56%) diff --git a/htdocs/profil.php b/htdocs/profil.php index 8a4d0f4..5588d93 100644 --- a/htdocs/profil.php +++ b/htdocs/profil.php @@ -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 diff --git a/htdocs/register/end.php b/htdocs/register/end.php index 5d75eed..d0f00af 100644 --- a/htdocs/register/end.php +++ b/htdocs/register/end.php @@ -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(); + ?> diff --git a/htdocs/register/index.php b/htdocs/register/index.php index e84f147..e00452f 100644 --- a/htdocs/register/index.php +++ b/htdocs/register/index.php @@ -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 index 0000000..cefe91b --- /dev/null +++ b/htdocs/register/success.php @@ -0,0 +1,44 @@ +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(); +?> diff --git a/include/register.inc.php b/include/register.inc.php index bb38292..df38f16 100644 --- a/include/register.inc.php +++ b/include/register.inc.php @@ -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 index 0000000..5c8c58c --- /dev/null +++ b/templates/register/end.tpl @@ -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 * + ***************************************************************************} + +

:'(

+ +

+Une erreur est survenue lors de ton inscription ... +

+

+Contacte nous au plus vite, en nous indiquant ce nombre : {$uid} sur +support@m4x.org +

+ +{* 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 index 0000000..a29b296 --- /dev/null +++ b/templates/register/success.tpl @@ -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 * + ***************************************************************************} + +

Bravo !!!

+ +

+Tu as maintenant accès au site !!! +Ton adresse électronique à vie {$forlife}@polytechnique.org est déjà ouverte, essaie-la ! +

+

+ 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. +

+ + +

Mot de passe

+ +{if $mdpok} + +

+ton mot de passe a bien été mis à jour ! +

+ +{else} + +

+Tu as recu un mot de passe par défaut, si tu souhaites en changer, tu peux le faire ici : +

+ +
+ + + + + + + + + + + + + + + +
+ Saisie du nouveau mot de passe +
+ Nouveau mot de passe : + + +
+ Retape-le une fois : + + +
+ +
+
+ +
+
+
+ +

+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. +

+ +{/if} + +

Rejoindre la communauté

+ +
+

+ Pour rejoindre la communauté des X sur le web, nous te convions le plus vivement à remplir ton profil !!! +

+ +

+ 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 : +

+ + + +
+ +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/upgrade/0.9.4/30_melix.sql b/upgrade/0.9.4/30_auth_user_quick.sql 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 --- a/upgrade/0.9.4/30_melix.sql +++ b/upgrade/0.9.4/30_auth_user_quick.sql @@ -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; + -- 2.1.4