From 85acf35c7fa1aa3a82cdd93e1b3a1c5492f73772 Mon Sep 17 00:00:00 2001
From: Matthew Juhl <mjuhl24@gmail.com>
Date: Thu, 17 Dec 2009 21:50:41 +0000
Subject: [PATCH] Add page handler for 'login'

---
 cas_auth/start.php | 45 +++++++++++++++++----------------------------
 1 file changed, 17 insertions(+), 28 deletions(-)

diff --git a/cas_auth/start.php b/cas_auth/start.php
index 8e9cd415..1ac305f3 100644
--- a/cas_auth/start.php
+++ b/cas_auth/start.php
@@ -160,7 +160,22 @@
 	if (isset($_SESSION['loggedWithCAS']) && $_SESSION['loggedWithCAS']===true) {
 		register_elgg_event_handler('logout', 'user', 'logoutCas');
 	}
-
+	
+	
+	/* set up login page */
+	register_page_handler('login', 'login_page_handler');
+	
+	function login_page_handler($page) {
+		// If we're not logged in, display the login page
+		if (!isloggedin()) {
+			page_draw(elgg_echo('login'), elgg_view("account/forms/login"));
+		// Otherwise, forward to the index page
+		} else {
+			forward();
+		}
+	}
+	
+	
 	/**
 	 * CAS client initialization
 	 * 
@@ -214,33 +229,7 @@
 		phpCAS::logout($CONFIG->url.'/action/logout');	
 	}
 	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
 	/**
    * LDAP authentication
    * 
-- 
GitLab