From: Olivier Berger Date: Thu, 14 Jun 2012 12:29:41 +0000 (+0000) Subject: Displays a message if the user doesn't exist, and rework the algorithm : post_login... X-Git-Tag: v5.3-rc1~2337 X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=commitdiff_plain;h=79a0e72ab5a488595a40277b5617e0cf43c49c5a Displays a message if the user doesn't exist, and rework the algorithm : post_login doesn't work with 1.3.1 --- diff --git a/src/plugins/authcas/www/post-login.php b/src/plugins/authcas/www/post-login.php index 804cb6f..8a5a2cb 100644 --- a/src/plugins/authcas/www/post-login.php +++ b/src/plugins/authcas/www/post-login.php @@ -53,46 +53,43 @@ if (forge_get_config('use_ssl') && !session_issecure()) { $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 .= '

'. _('Your account '.$cas_username.' does not exist.').'

'; + } + } 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; - } - } } }