Fix registration.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 5 Jan 2009 20:07:21 +0000 (21:07 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 5 Jan 2009 20:07:21 +0000 (21:07 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/xorgsession.php
modules/register.php

index 91cda51..c9ac0b7 100644 (file)
@@ -255,6 +255,21 @@ class XorgSession extends PlSession
         return true;
     }
 
+    /** Start a session without authentication data for the given user.
+     * This is used to identify the user after his registration, to be
+     * removed after rewriting registration procedure.
+     * XXX: Temporary
+     */
+    public function startWeakSession($user)
+    {
+        if (!$this->startSessionAs($user, AUTH_MDP)) {
+            $this->destroy();
+            return false;
+        }
+        S::set('auth', AUTH_MDP);
+        return true;
+    }
+
     private function securityChecks()
     {
         $mail_subject = array();
index 9089244..be4ff7e 100644 (file)
@@ -342,10 +342,9 @@ class RegisterModule extends PLModule
         // update number of subscribers (perms has changed)
         $globals->updateNbIns();
 
-        if (!start_connexion($uid, false)) {
+        if (!Platal::session()->startWeakSession($uid)) {
             return PL_FORBIDDEN;
         }
-        $_SESSION['auth'] = AUTH_MDP;
 
         /***********************************************************/
         /************* envoi d'un mail au démarcheur ***************/
@@ -396,8 +395,8 @@ class RegisterModule extends PLModule
                  . " - forlife   : $forlife\n"
                  . " - email     : $email\n"
                  . " - sexe      : $femme\n"
-                 . " - ip        : {$logger->ip} ({$logger->host})\n"
-                 . ($logger->proxy_ip ? " - proxy     : {$logger->proxy_ip} ({$logger->proxy_host})\n" : "")
+                 . " - ip        : " . S::logger()->ip . " (" . S::logger()->host . ")\n"
+                 . (S::logger()->proxy_ip ? " - proxy     : " . S::logger()->proxy_ip . " (" . S::logger()->proxy_host . ")\n" : "")
                  . "\n\n";
             if (count($market) > 0) {
                 $msg .= "Les marketings suivants avaient été effectués :\n"
@@ -515,7 +514,8 @@ class RegisterModule extends PLModule
         }
         if (Post::v('imap')) {
             require_once 'emails.inc.php';
-            $storage = new EmailStorage(S::v('uid'), 'imap');
+            $user = S::user();
+            $storage = new EmailStorage($user, 'imap');
             $storage->activate();
         }