Merge branch 'MDL-32777' of git://github.com/danpoltawski/moodle
[moodle.git] / auth / ldap / ntlmsso_attempt.php
blob8624b38b57d7822e154f0c8d34bc5e931ce5fcb0
1 <?php
3 require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
5 //HTTPS is required in this page when $CFG->loginhttps enabled
6 $PAGE->https_required();
8 $PAGE->set_url('/auth/ldap/ntlmsso_attempt.php');
9 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
11 // Define variables used in page
12 $site = get_site();
14 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
15 if (!in_array('ldap', $authsequence, true)) {
16 print_error('ldap_isdisabled', 'auth');
19 $authplugin = get_auth_plugin('ldap');
20 if (empty($authplugin->config->ntlmsso_enabled)) {
21 print_error('ntlmsso_isdisabled', 'auth_ldap');
24 $sesskey = sesskey();
26 // Display the page header. This makes redirect respect the timeout we specify
27 // here (and not add 3 more secs) which in turn prevents a bug in both IE 6.x
28 // and FF 3.x (Windows version at least) where javascript timers fire up even
29 // when we've already left the page that set the timer.
30 $loginsite = get_string("loginsite");
31 $PAGE->navbar->add($loginsite);
32 $PAGE->set_title("$site->fullname: $loginsite");
33 $PAGE->set_heading($site->fullname);
34 echo $OUTPUT->header();
36 $msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
37 . '<img width="1", height="1" '
38 . ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
39 . $sesskey . '" />';
40 redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);