2007-11-14 22:08:38 +00:00
|
|
|
<?php
|
|
|
|
|
2016-02-26 17:47:58 +11:00
|
|
|
require(__DIR__.'/../../config.php');
|
2007-11-14 22:08:38 +00:00
|
|
|
|
2010-10-10 15:04:19 +00:00
|
|
|
//HTTPS is required in this page when $CFG->loginhttps enabled
|
|
|
|
$PAGE->https_required();
|
2007-11-14 22:08:38 +00:00
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$PAGE->set_url('/auth/ldap/ntlmsso_attempt.php');
|
2012-08-02 11:20:48 +08:00
|
|
|
$PAGE->set_context(context_system::instance());
|
2009-10-15 02:34:31 +00:00
|
|
|
|
2010-07-25 22:36:15 +00:00
|
|
|
// Define variables used in page
|
2009-11-01 09:10:09 +00:00
|
|
|
$site = get_site();
|
2007-11-14 22:08:38 +00:00
|
|
|
|
|
|
|
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
2010-07-25 22:36:15 +00:00
|
|
|
if (!in_array('ldap', $authsequence, true)) {
|
|
|
|
print_error('ldap_isdisabled', 'auth');
|
2007-11-14 22:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$authplugin = get_auth_plugin('ldap');
|
|
|
|
if (empty($authplugin->config->ntlmsso_enabled)) {
|
2010-07-25 22:36:15 +00:00
|
|
|
print_error('ntlmsso_isdisabled', 'auth_ldap');
|
2007-11-14 22:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$sesskey = sesskey();
|
|
|
|
|
2009-02-14 16:21:14 +00:00
|
|
|
// Display the page header. This makes redirect respect the timeout we specify
|
|
|
|
// here (and not add 3 more secs) which in turn prevents a bug in both IE 6.x
|
|
|
|
// and FF 3.x (Windows version at least) where javascript timers fire up even
|
|
|
|
// when we've already left the page that set the timer.
|
|
|
|
$loginsite = get_string("loginsite");
|
2009-09-03 05:40:41 +00:00
|
|
|
$PAGE->navbar->add($loginsite);
|
|
|
|
$PAGE->set_title("$site->fullname: $loginsite");
|
|
|
|
$PAGE->set_heading($site->fullname);
|
|
|
|
echo $OUTPUT->header();
|
2009-02-14 16:21:14 +00:00
|
|
|
|
2012-06-28 15:32:33 +08:00
|
|
|
// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
|
2010-07-25 22:36:15 +00:00
|
|
|
$msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
|
2007-11-14 22:08:38 +00:00
|
|
|
. '<img width="1", height="1" '
|
2012-06-28 15:32:33 +08:00
|
|
|
. ' src="' . $CFG->httpswwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
|
2007-11-14 22:08:38 +00:00
|
|
|
. $sesskey . '" />';
|
2012-06-28 15:32:33 +08:00
|
|
|
redirect($CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
|