From 5a97f0d96bf6c7c36378571aeeec4bdcce6925ee Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Wed, 17 Feb 2010 01:32:14 +0000 Subject: [PATCH] mnet MDL-21257 temporary fix for mnet breaking on session regeneration. This is fixed better, but more obtrusively in 2.0 --- auth/mnet/auth.php | 11 +++++++++++ auth/mnet/land.php | 1 + 2 files changed, 12 insertions(+) diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 6c9ee752b33..42a1f68dd98 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -230,6 +230,17 @@ class auth_plugin_mnet extends auth_plugin_base { return $url; } + /** + * after a successful login, land.php will call complete_user_login + * which will in turn regenerate the session id. + * this means that what is stored in mnet_session table needs updating. + * + */ + function update_session_id() { + global $USER; + return set_field('mnet_session', 'session_id', session_id(), 'username', $USER->username, 'mnethostid', $USER->mnethostid, 'useragent', sha1($_SERVER['HTTP_USER_AGENT'])); + } + /** * This function confirms the remote (ID provider) host's mnet session * by communicating the token and UA over the XMLRPC transport layer, and diff --git a/auth/mnet/land.php b/auth/mnet/land.php index 82ddd167c7e..e59cc4527ea 100644 --- a/auth/mnet/land.php +++ b/auth/mnet/land.php @@ -34,6 +34,7 @@ $localuser = $mnetauth->confirm_mnet_session($token, $remotewwwroot); // log in $USER = get_complete_user_data('id', $localuser->id, $localuser->mnethostid); complete_user_login($USER); +$mnetauth->update_session_id(); if (!empty($localuser->mnet_foreign_host_array)) { $USER->mnet_foreign_host_array = $localuser->mnet_foreign_host_array;