From 7c77c3ee4075c6e860a4250ec3e41f24b64c179b Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 9 Jul 2006 00:02:52 +0000 Subject: [PATCH] motdepasse -> password git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@400 839d8a87-29fc-0310-9880-83ba4fa771e5 --- hooks/tmp.inc.php | 2 +- htdocs/motdepasse.php | 46 ----------------------------------------- include/login.conf.php | 10 ++++----- modules/platal.php | 33 +++++++++++++++++++++++++++++ templates/inscription/step4.tpl | 43 -------------------------------------- templates/preferences.tpl | 2 +- 6 files changed, 40 insertions(+), 96 deletions(-) delete mode 100644 htdocs/motdepasse.php delete mode 100644 templates/inscription/step4.tpl diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index e83fd3f..dcca4ef 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -26,7 +26,7 @@ function tmp_menu() $globals->menu->addPrivateEntry(XOM_CUSTOM, 10, 'Mon profil', 'profil.php'); $globals->menu->addPrivateEntry(XOM_CUSTOM, 20, 'Mes contacts', 'carnet/mescontacts.php'); $globals->menu->addPrivateEntry(XOM_CUSTOM, 30, 'Mon carnet', 'carnet/'); - $globals->menu->addPrivateEntry(XOM_CUSTOM, 40, 'Mon mot de passe', 'motdepasse.php'); + $globals->menu->addPrivateEntry(XOM_CUSTOM, 40, 'Mon mot de passe', 'password'); $globals->menu->addPrivateEntry(XOM_CUSTOM, 50, 'Mes préférences', 'preferences'); $globals->menu->addPrivateEntry(XOM_GROUPS, 10, 'Trombi/Site promo', 'trombipromo.php'); diff --git a/htdocs/motdepasse.php b/htdocs/motdepasse.php deleted file mode 100644 index a590dd1..0000000 --- a/htdocs/motdepasse.php +++ /dev/null @@ -1,46 +0,0 @@ -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', hash_encrypt($password), (time()+25920000), '/', '' ,0); - } - - new_skinned_page('motdepasse.success.tpl', AUTH_MDP); - $page->run(); -} - -new_skinned_page('motdepasse.tpl', AUTH_MDP); -$page->addJsLink('javascript/motdepasse.js'); -$page->assign('xorg_title','Polytechnique.org - Mon mot de passe'); -$page->run(); -?> diff --git a/include/login.conf.php b/include/login.conf.php index 6d8faca..c577dfd 100644 --- a/include/login.conf.php +++ b/include/login.conf.php @@ -5,15 +5,15 @@ $pub_nbCol = 2 ; // Liens apparaissant toujours $pub_tjs = array( - "motdepasse.php" => "Changer mon mot de passe" , - "Docs/Dons" => "Faire un don à l'association Polytechnique.org" + 'password' => 'Changer mon mot de passe' , + 'Docs/Dons' => 'Faire un don à l\'association Polytechnique.org' ) ; // Liens apparaissant de façon aléatoire $pub_rnd = array( - "newsletter/show.php?nid=last" => "Afficher la dernière newsletter" , - "http://www.polytechnique.net" => "Vers les autres sites polytechniciens" , + 'newsletter/show.php?nid=last' => 'Afficher la dernière newsletter' , + 'http://www.polytechnique.net' => 'Vers les autres sites polytechniciens' , "trombipromo.php?xpromo={$_SESSION["promo"]}" => "Voir le trombi de ma promo" , - "banana/" => "Un petit tour du côté des forums !!" + 'banana/' => 'Un petit tour du côté des forums !!' ) ; ?> diff --git a/modules/platal.php b/modules/platal.php index 356927f..640e1ca 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -25,6 +25,7 @@ class PlatalModule extends PLModule { return array( 'preferences' => $this->make_hook('prefs', AUTH_COOKIE), + 'password' => $this->make_hook('password', AUTH_MDP), 'skin' => $this->make_hook('skin', AUTH_COOKIE), ); } @@ -68,6 +69,38 @@ class PlatalModule extends PLModule return PL_OK; } + function handler_password(&$page) + { + global $globals; + + if (Post::has('response2')) { + require_once 'secure_hash.inc.php'; + + $_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', hash_encrypt($password), (time()+25920000), '/', '' ,0); + } + + $page->changeTpl('motdepasse.success.tpl'); + $page->run(); + } + + $page->changeTpl('motdepasse.tpl'); + $page->addJsLink('javascript/motdepasse.js'); + $page->assign('xorg_title','Polytechnique.org - Mon mot de passe'); + + return PL_OK; + } + function handler_skin(&$page) { global $globals; diff --git a/templates/inscription/step4.tpl b/templates/inscription/step4.tpl deleted file mode 100644 index 3a2bad3..0000000 --- a/templates/inscription/step4.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{**************************************************************************} -{* *} -{* Copyright (C) 2003-2006 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 *} -{* *} -{**************************************************************************} - -

Dernière étape

-

- Tu as maintenant accès au site en utilisant les paramètres reçus par mail. - 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. -

-

-Clique ici pour changer ton mot de passe. -

-

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

- -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/preferences.tpl b/templates/preferences.tpl index 56ced8b..29b6004 100644 --- a/templates/preferences.tpl +++ b/templates/preferences.tpl @@ -55,7 +55,7 @@ -

Changer mon mot de passe pour le site

+

Changer mon mot de passe pour le site

permet de changer ton mot de passe pour accéder au site Polytechnique.org
-- 2.1.4