diff --git a/cas_auth/start.php b/cas_auth/start.php
index 8e9cd415c3b3b70b19903d73880fed295198d600..1ac305f3be05dc106309c6c6781b3350ff7db9bc 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
    *