[Fusionforge-commits] r15777 - trunk/src/plugins/authcas/www

Olivier Berger olberger at fusionforge.org
Thu Jun 14 14:29:41 CEST 2012


Author: olberger
Date: 2012-06-14 14:29:41 +0200 (Thu, 14 Jun 2012)
New Revision: 15777

Modified:
   trunk/src/plugins/authcas/www/post-login.php
Log:
Displays a message if the user doesn't exist, and rework the algorithm : post_login doesn't work with 1.3.1

Modified: trunk/src/plugins/authcas/www/post-login.php
===================================================================
--- trunk/src/plugins/authcas/www/post-login.php	2012-06-14 12:21:23 UTC (rev 15776)
+++ trunk/src/plugins/authcas/www/post-login.php	2012-06-14 12:29:41 UTC (rev 15777)
@@ -53,46 +53,43 @@
 $plugin->initCAS();
 
 if (phpCAS::isAuthenticated()) {
+
+	$success = false;
+	$cas_username = '';
+
 	if ($plugin->isSufficient()) {
-		$plugin->startSession(phpCAS::getUser());
+
+		$cas_username = phpCAS::getUser();
+		$success = $plugin->startSession($cas_username);
 	}
-	if ($return_to) {
-		validate_return_to($return_to);
-		session_redirect($return_to);
-		//header ("Location: " . util_make_url($return_to));
-		//exit;
-	} else {
-		session_redirect("/my");
-		//header ("Location: " . util_make_url("/my"));
-		//exit;
+
+	if($success) {
+
+		if ($return_to) {
+
+			validate_return_to($return_to);
+			session_redirect($return_to);
+			//header ("Location: " . util_make_url($return_to));                                                                                                                                                                                                                    
+			//exit;                                                                                                                                                                                                                                                                 
+		} else {
+
+			session_redirect("/my");
+			//header ("Location: " . util_make_url("/my"));                                                                                                                                                                                                                         
+			//exit;                                                                                                                                                                                                                                                                 
+		}
 	}
+
+	else {
+		$warning_msg .= '<br /><p>'. _('Your account '.$cas_username.' does not exist.').'</p>';
+	}
+
 } else {
+
 	if ($login) {		     // The user just clicked the Login button
 		// Let's send them to CAS
 
-		$return_url = util_make_url('/plugins/authcas/post-login.php?postcas=true&return_to='.htmlspecialchars($return_to));
-
-		$GLOBALS['PHPCAS_CLIENT']->setURL($return_url);
-
 		phpCAS::forceAuthentication();
 
-	} elseif ($postcas) {		// The user is coming back from CAS
-		if (phpCAS::isAuthenticated()) {
-			if ($plugin->isSufficient()) {
-				$plugin->startSession(phpCAS::getUser());
-			}
-			if ($return_to) {
-				validate_return_to($return_to);
-
-				session_redirect($return_to);
-				//header ("Location: " . util_make_url($return_to));
-				//exit;
-			} else {
-				session_redirect("/my");
-				//header ("Location: " . util_make_url("/my"));
-				//exit;
-			}
-		}
 	}
 }
 




More information about the Fusionforge-commits mailing list