[Fusionforge-commits] r12139 - branches/Branch_5_1/src/www/account

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Feb 3 14:37:48 CET 2011


Author: lolando
Date: 2011-02-03 14:37:48 +0100 (Thu, 03 Feb 2011)
New Revision: 12139

Modified:
   branches/Branch_5_1/src/www/account/login.php
   branches/Branch_5_1/src/www/account/logout.php
Log:
Harmonise return_to behaviour for login and logout, and stop redirecting to inaccessible pages such as /my/ on logout

Modified: branches/Branch_5_1/src/www/account/login.php
===================================================================
--- branches/Branch_5_1/src/www/account/login.php	2011-02-03 13:24:47 UTC (rev 12138)
+++ branches/Branch_5_1/src/www/account/login.php	2011-02-03 13:37:48 UTC (rev 12139)
@@ -54,7 +54,7 @@
 	    || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
 		$newrt = $return_to ;
 	} else {
-		$newrt = '' ;
+		$newrt = '/' ;
 	}
 	$return_to = $newrt ;
 }
@@ -83,10 +83,10 @@
 			You can now optionally stay in SSL mode
 		*/
 		if ($return_to) {
-			header ("Location: " . $return_to);
+			header ("Location: " . util_make_url($return_to));
 			exit;
 		} else {
-			header ("Location: ".util_make_url ("/my/"));
+			header ("Location: " . util_make_url("/my"));
 			exit;
 		}
 	}

Modified: branches/Branch_5_1/src/www/account/logout.php
===================================================================
--- branches/Branch_5_1/src/www/account/logout.php	2011-02-03 13:24:47 UTC (rev 12138)
+++ branches/Branch_5_1/src/www/account/logout.php	2011-02-03 13:37:48 UTC (rev 12139)
@@ -34,17 +34,29 @@
 //      Validate return_to
 //
 if ($return_to) {
-        $tmpreturn=explode('?',$return_to);
-        if (!@is_file(forge_get_config('url_root').$tmpreturn[0]) && !@is_dir(forge_get_config('url_root').$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'plugins/mediawiki') == 1)) {
-	$return_to='';
-}				        }
+        $tmpreturn = explode('?',$return_to);
+	$rtpath = $tmpreturn[0] ;
 
+	if (@is_file(forge_get_config('url_root').$rtpath)
+	    || @is_dir(forge_get_config('url_root').$rtpath)
+	    || (strpos($rtpath,'/projects') == 0)
+	    || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
+		$newrt = $return_to ;
+	} else {
+		$newrt = '/' ;
+	}
+
+	if ($return_to == '/my' || $return_to == '/account') {
+		$return_to = '/';
+	}
+}
+
 session_logout();
 
 plugin_hook('before_logout_redirect');
 
 if ($return_to) {
-	header('Location: '.$return_to);
+	header('Location: '.util_make_url ($return_to));
 }else{
 	header('Location: '.util_make_url ('/'));
 }




More information about the Fusionforge-commits mailing list