exit tmpPWD
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 9 Jul 2006 00:12:45 +0000 (00:12 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 9 Jul 2006 00:12:45 +0000 (00:12 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@401 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/recovery.php
htdocs/tmpPWD.php [deleted file]
install.d/platal.files
modules/platal.php

index 3c7e1fc..8045fd2 100644 (file)
@@ -54,7 +54,7 @@ if (Env::has('login') and Env::has('birth'))  {
        $mymail->addTo($mails);
        $mymail->setSubject('Ton certificat d\'authentification');
         $mymail->setTxtBody("Visite la page suivante qui expire dans six heures :
-{$globals->baseurl}/tmpPWD.php?certificat=$url
+{$globals->baseurl}/tmpPWD/$url
 
 Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur.
 
diff --git a/htdocs/tmpPWD.php b/htdocs/tmpPWD.php
deleted file mode 100644 (file)
index aa1b62b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/***************************************************************************
- *  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                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-
-$globals->xdb->execute('DELETE FROM perte_pass WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
-
-$certif = Env::get('certificat');
-$res    = $globals->xdb->query('SELECT uid FROM perte_pass WHERE certificat={?}', $certif);
-
-if ($ligne = $res->fetchOneAssoc())  {
-    $uid = $ligne["uid"];
-    if (Post::has('response2')) {
-        $password = Post::get('response2');
-        $logger   = new DiogenesCoreLogger($uid);
-        $globals->xdb->query('UPDATE auth_user_md5 SET password={?} WHERE user_id={?} AND perms IN("admin","user")', $password, $uid);
-        $globals->xdb->query('DELETE FROM perte_pass WHERE certificat={?}', $certif);
-        $logger->log("passwd","");
-        new_skinned_page('tmpPWD.success.tpl', AUTH_PUBLIC);
-        $page->run();
-    } else {
-        new_skinned_page('motdepasse.tpl', AUTH_PUBLIC);
-        $page->addJsLink('javascript/motdepasse.js');
-        $page->run();
-    }
-} else {
-    new_skinned_page('index.tpl', AUTH_PUBLIC);
-    $page->kill("Cette adresse n'existe pas ou n'existe plus sur le serveur.");
-}
-
-?>
index 396cb9c..5a72241 100644 (file)
@@ -250,14 +250,10 @@ htdocs/images/sk_default_headlogo.jpg
 htdocs/images/sk_default_lesX.gif
 htdocs/images/sk_default_snapshot.png
 htdocs/images/sk_default_titre.gif
-htdocs/index.php
 htdocs/javascript/do_challenge_response.js
 htdocs/javascript/md5.js
 htdocs/javascript/xorg.js
-htdocs/motdepasse.php
-htdocs/preferences.php
 htdocs/recovery.php
-htdocs/tmpPWD.php
 include/validations.inc.php
 include/xml-rpc-client.inc.php
 include/platal/database.inc.php
index 640e1ca..488743d 100644 (file)
@@ -26,6 +26,7 @@ class PlatalModule extends PLModule
         return array(
             'preferences' => $this->make_hook('prefs', AUTH_COOKIE),
             'password'    => $this->make_hook('password', AUTH_MDP),
+            'tmpPWD'      => $this->make_hook('tmpPWD', AUTH_PUBLIC),
             'skin'        => $this->make_hook('skin', AUTH_COOKIE),
         );
     }
@@ -101,6 +102,38 @@ class PlatalModule extends PLModule
         return PL_OK;
     }
 
+    function handler_tmpPWD(&$page, $certif = null)
+    {
+        global $globals;
+
+        $globals->xdb->execute('DELETE FROM perte_pass
+                                      WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
+
+        $res   = $globals->xdb->query('SELECT uid FROM perte_pass WHERE certificat={?}', $certif);
+        $ligne = $res->fetchOneAssoc();
+        if (!$ligne) {
+            $page->changeTpl('index.tpl');
+            $page->kill("Cette adresse n'existe pas ou n'existe plus sur le serveur.");
+        }
+
+        $uid = $ligne["uid"];
+        if (Post::has('response2')) {
+            $password = Post::get('response2');
+            $logger   = new DiogenesCoreLogger($uid);
+            $globals->xdb->query('UPDATE  auth_user_md5 SET password={?}
+                                   WHERE  user_id={?} AND perms IN("admin","user")',
+                                 $password, $uid);
+            $globals->xdb->query('DELETE FROM perte_pass WHERE certificat={?}', $certif);
+            $logger->log("passwd","");
+            $page->changeTpl('tmpPWD.success.tpl');
+        } else {
+            $page->changeTpl('motdepasse.tpl');
+            $page->addJsLink('javascript/motdepasse.js');
+        }
+
+        return PL_OK;
+    }
+
     function handler_skin(&$page)
     {
         global $globals;