mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Prevent MNet error message when multiple records for the user are found in mnet_session table
This commit is contained in:
parent
35d76df31d
commit
ee4cd8f16d
1 changed files with 10 additions and 3 deletions
|
@ -464,9 +464,16 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||||
}
|
}
|
||||||
// make sure it is a user we have an in active session
|
// make sure it is a user we have an in active session
|
||||||
// with that host...
|
// with that host...
|
||||||
if (!$userid = $DB->get_field('mnet_session', 'userid',
|
$mnetsessions = $DB->get_records('mnet_session', array('username' => $username, 'mnethostid' => $remoteclient->id), '', 'id, userid');
|
||||||
array('username'=>$username, 'mnethostid'=>$remoteclient->id))) {
|
$userid = null;
|
||||||
throw new mnet_server_exception(1, 'authfail_nosessionexists');
|
foreach ($mnetsessions as $mnetsession) {
|
||||||
|
if (is_null($userid)) {
|
||||||
|
$userid = $mnetsession->userid;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($userid != $mnetsession->userid) {
|
||||||
|
throw new mnet_server_exception(3, 'authfail_usermismatch');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($courses)) { // no courses? clear out quickly
|
if (empty($courses)) { // no courses? clear out quickly
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue