1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require(__DIR__.'/../../config.php');
|
|
|
4 |
|
|
|
5 |
$PAGE->set_url('/auth/ldap/ntlmsso_attempt.php');
|
|
|
6 |
$PAGE->set_context(context_system::instance());
|
|
|
7 |
|
|
|
8 |
// Define variables used in page
|
|
|
9 |
$site = get_site();
|
|
|
10 |
|
|
|
11 |
$authsequence = get_enabled_auth_plugins(); // Auths, in sequence.
|
|
|
12 |
if (!in_array('ldap', $authsequence, true)) {
|
|
|
13 |
throw new \moodle_exception('ldap_isdisabled', 'auth');
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
$authplugin = get_auth_plugin('ldap');
|
|
|
17 |
if (empty($authplugin->config->ntlmsso_enabled)) {
|
|
|
18 |
throw new \moodle_exception('ntlmsso_isdisabled', 'auth_ldap');
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
$sesskey = sesskey();
|
|
|
22 |
|
|
|
23 |
// Display the page header. This makes redirect respect the timeout we specify
|
|
|
24 |
// here (and not add 3 more secs) which in turn prevents a bug in both IE 6.x
|
|
|
25 |
// and FF 3.x (Windows version at least) where javascript timers fire up even
|
|
|
26 |
// when we've already left the page that set the timer.
|
|
|
27 |
$loginsite = get_string("loginsite");
|
|
|
28 |
$PAGE->navbar->add($loginsite);
|
|
|
29 |
$PAGE->set_title($loginsite);
|
|
|
30 |
$PAGE->set_heading($site->fullname);
|
|
|
31 |
echo $OUTPUT->header();
|
|
|
32 |
|
|
|
33 |
$msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
|
|
|
34 |
. '<img width="1", height="1" '
|
|
|
35 |
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
|
|
|
36 |
. $sesskey . '" />';
|
|
|
37 |
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
|