Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.7
-
None
-
None
-
MOODLE_37_STABLE
Description
Steps to reproduce the error:
- Enable both CAS SSO authentication and Email-based self-registration authentication plugins.
- Login to other system with CAS SSO authentication, and then redirect to Moodle to access a course (https://www.examplemoodle.com/course/view.php?id=99)
- Then moodle direct back to https://www.examplemoodle.com/login/index.php page to select login method.
- When user click https://www.examplemoodle.com/login/index.php?authCAS=CAS it shows as user already logged in.
Expected outcome:
User will direct to the particular course page without landing into https://www.examplemoodle.com/login/index.php
Background:
This happens because of loginpage_hook method in auth/cas/auth.php.
// If the multi-authentication setting is used, check for the param before connecting to CAS.
if ($this->config->multiauth) {
// If there is an authentication error, stay on the default authentication page.
if (!empty($SESSION->loginerrormsg))
$authCAS = optional_param('authCAS', '', PARAM_RAW);
if ($authCAS == 'NOCAS') { return; }
// Show authentication form for multi-authentication.
// Test pgtIou parameter for proxy mode (https connection in background from CAS server to the php server).
if ($authCAS != 'CAS' && !isset($_GET['pgtIou']))
}
When $authCAS is not equal to 'CAS' it redirects users into '/login/index.php'. On the other hand this is important to get manual login option.
However if user already logged in using CAS, it should go here,
if (phpCAS::checkAuthentication()) {
$frm = newstdClass();
$frm->username = phpCAS::getUser();
$frm->password = 'passwdCas';
// Redirect to a course if multi-auth is activated, authCAS is set to CAS and the courseid is specified.
if ($this->config->multiauth && !empty($courseid))
return;
}
// Force CAS authentication (if needed).
if (!phpCAS::isAuthenticated())
Challenge here is, it should only happen if user already logged in using CAS SSO, otherwise both options should available to login.