Implemented the password-reset redirect _properly_ instead of the hackish direct header() call in sessions.php
authorDan
Tue, 08 Apr 2008 20:30:05 -0400
changeset 521 d264784355e5
parent 520 4c16e87cfeae
child 525 3f2dfdb99be4
Implemented the password-reset redirect _properly_ instead of the hackish direct header() call in sessions.php
includes/sessions.php
plugins/SpecialUserFuncs.php
--- a/includes/sessions.php	Tue Apr 08 20:29:18 2008 -0400
+++ b/includes/sessions.php	Tue Apr 08 20:30:05 2008 -0400
@@ -956,9 +956,11 @@
           eval($cmd);
         }
         
-        header('Location: ' . makeUrlComplete('Special', 'PasswordReset/stage2/' . $row['user_id'] . '/' . $row['temp_password']) );
-        
-        exit;
+        return array(
+            'success' => false,
+            'error' => 'valid_reset',
+            'redirect_url' => makeUrlComplete('Special', 'PasswordReset/stage2/' . $row['user_id'] . '/' . $row['temp_password'])
+          );
       }
     }
     
--- a/plugins/SpecialUserFuncs.php	Tue Apr 08 20:29:18 2008 -0400
+++ b/plugins/SpecialUserFuncs.php	Tue Apr 08 20:30:05 2008 -0400
@@ -542,6 +542,14 @@
     }
     else
     {
+      if ( $result['error'] === 'valid_reset' )
+      {
+        header('HTTP/1.1 302 Temporary Redirect');
+        header('Location: ' . $result['redirect_url']);
+        
+        $db->close();
+        exit();
+      }
       $GLOBALS['__login_status'] = $result;
     }
   }