mirror of
https://github.com/moodle/moodle.git
synced 2025-04-26 19:03:38 +02:00
Checking in some old changes
This commit is contained in:
parent
9b2831eb77
commit
8a8333860e
@ -10,7 +10,7 @@
|
||||
//MW theres no easy way to log in seamlessly. We need the users unhashed password.
|
||||
// It's a security risk to carry that in $SESSION so we put up login form.
|
||||
print_header();
|
||||
notify('Your Hive session has expired. Please reauthenticate using your usual Moodle login');
|
||||
notify('Your session has expired. Please log in again.');
|
||||
?>
|
||||
<form action="login.php" method="post" name="login" id="login">
|
||||
<table border="0" align="center">
|
||||
|
@ -41,13 +41,6 @@ function sso_user_login($username, $password) {
|
||||
/// We use POST to call Hive with a bit more security
|
||||
$snoopy->submit($submit_url,$submit_vars);
|
||||
|
||||
/// If there's a bug, we may need to use GET instead
|
||||
/// foreach ($submit_vars as $name => $value) {
|
||||
/// $params[] = "$name=".urlencode($value);
|
||||
/// }
|
||||
/// $submit_url .= '?'.implode('&', $params);
|
||||
/// $snoopy->fetch($submit_url);
|
||||
|
||||
/// Extract HIVE_SESSION from headers
|
||||
|
||||
foreach ($snoopy->headers as $header) {
|
||||
@ -57,11 +50,29 @@ function sso_user_login($username, $password) {
|
||||
$cookie = explode(';', $header[1]);
|
||||
$cookie = $cookie[0];
|
||||
$SESSION->HIVE_SESSION = $cookie;
|
||||
$SESSION->HIVE_PASSWORD = $password;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Try again with the guest username and password
|
||||
|
||||
$submit_vars['HIVE_UNAME'] = $CFG->hiveusername;
|
||||
$submit_vars['HIVE_UPASS'] = $CFG->hivepassword;
|
||||
$submit_vars['HIVE_ENDUSER']= $CFG->hiveusername;
|
||||
$snoopy->submit($submit_url,$submit_vars);
|
||||
foreach ($snoopy->headers as $header) {
|
||||
if (strpos($header, 'HIVE_SESSION=') !== false) {
|
||||
$header = explode('HIVE_SESSION=', $header);
|
||||
if (count($header) > 1) {
|
||||
$cookie = explode(';', $header[1]);
|
||||
$cookie = $cookie[0];
|
||||
$SESSION->HIVE_SESSION = $cookie;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false; // No cookie found
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
if (sso_user_login($frm->username, $frm->password)) {
|
||||
|
||||
/// reopen Hive
|
||||
redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openhive.php');
|
||||
redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php');
|
||||
} else {
|
||||
redirect($CFG->wwwroot.'/sso/hive/expired.php');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user