diff --git a/plugins/cas_auth_unl/start.php b/plugins/cas_auth_unl/start.php index 461efe38e31b8c7a30f3945c8f562f906b1264b6..5f250f92719fce71eb743e81c68881d4b28395ff 100644 --- a/plugins/cas_auth_unl/start.php +++ b/plugins/cas_auth_unl/start.php @@ -24,7 +24,7 @@ } - register_action("getemail",true,$CONFIG->pluginspath . "cas_auth_unl/views/default/actions/getemail.php"); + register_action("getemail",true,$CONFIG->pluginspath . "cas_auth_unl/actions/getemail.php"); register_action("login",false,$CONFIG->pluginspath. "cas_auth_unl/actions/login.php"); register_action("logout",false,$CONFIG->pluginspath. "cas_auth_unl/actions/logout.php"); @@ -34,17 +34,27 @@ // Set up login page, this creates the url /pg/login to be used as our 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(); - } - } + register_page_handler('login', 'login_page_handler'); + /* set up getemail page */ + register_page_handler('getemail', 'getemail_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(); + } + } + function getemail_page_handler($page) { + if (!isloggedin()) { + page_draw(elgg_echo('Your Email'), elgg_view("account/forms/getemail")); + } else { + forward(); + } + } + @@ -102,7 +112,7 @@ class elggSimpleCas { return true; } - public function casAuthenticate($username){ + public function casAuthenticate($username,$email=""){ if (empty($username)) return false; @@ -125,16 +135,13 @@ class elggSimpleCas { } else { // Valid login but user doesn't exist $pf_user_info = peoplefinderServices($casusername); - $name = $pf_user_info->cn; - if (isset($_REQUEST['email'])) { - $email = $_REQUEST['email']; - } else { + if (empty($email)){ if($pf_user_info->mail) - forward($CONFIG->url . 'mod/cas_auth/views/default/account/getemail.php?e=' . $pf_user_info->mail); + forward($CONFIG->url . 'pg/getemail?e=' . $pf_user_info->mail); else - forward($CONFIG->url . 'mod/cas_auth/views/default/account/getemail.php'); + forward($CONFIG->url . 'pg/getemail'); } try {