mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Can provide an alternate page for the login form.
The page must contain a form with an action field set to /login/index.php and return fields username and password TODO It may be worth checking the URL when it's entered at admin/auth.php to ensure it is at least pointing to a valid page as an incorrect URL could potentially lock all users out of a site.
This commit is contained in:
parent
f4cbf7f214
commit
5b2ae5848c
4 changed files with 29 additions and 2 deletions
|
@ -61,6 +61,9 @@
|
||||||
if (! isset($config->guestloginbutton)) {
|
if (! isset($config->guestloginbutton)) {
|
||||||
$config->guestloginbutton = 1;
|
$config->guestloginbutton = 1;
|
||||||
}
|
}
|
||||||
|
if (! isset($config->alternateloginurl)) {
|
||||||
|
$config->alternateloginurl = '';
|
||||||
|
}
|
||||||
if (! isset($config->auth_instructions)) {
|
if (! isset($config->auth_instructions)) {
|
||||||
$config->auth_instructions = "";
|
$config->auth_instructions = "";
|
||||||
}
|
}
|
||||||
|
@ -160,6 +163,22 @@
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// An alternate url for the login form. It means we can use login forms that are integrated
|
||||||
|
/// into non-moodle pages
|
||||||
|
echo '<tr valign="top">';
|
||||||
|
echo '<td algin="right" nowrap="nowrap">';
|
||||||
|
print_string('alternateloginurl', 'auth');
|
||||||
|
echo '</td>';
|
||||||
|
echo '<td>';
|
||||||
|
echo '<input type="text" size="40" name="alternateloginurl" alt="'.get_string('alternateloginurl', 'auth').'" value="'.$config->alternateloginurl.'" />';
|
||||||
|
echo '</td>';
|
||||||
|
echo '<td>';
|
||||||
|
print_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php'));
|
||||||
|
echo '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
|
echo '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// auth.php - created with Moodle 1.5 UNSTABLE DEVELOPMENT (2005010100)
|
// auth.php - created with Moodle 1.5 UNSTABLE DEVELOPMENT (2005010100)
|
||||||
|
|
||||||
|
|
||||||
|
$string['alternatelogin'] = 'If you enter a URL here, it will be used as the login page for this site. The page should contain a form which has the action property set to <strong>\'$a\'</strong> and return fields <strong>username</strong> and <strong>password</strong>.<br />Be careful not to enter an incorrect URL as you may lock yourself out of this site.<br />Leave this setting blank to use the default login page.';
|
||||||
|
$string['alternateloginurl'] = 'Alternate Login URL';
|
||||||
$string['auth_cas_logincas'] = 'Secure connection access';
|
$string['auth_cas_logincas'] = 'Secure connection access';
|
||||||
$string['auth_cas_invalidcaslogin'] = 'Sorry, your login has failed - you could not be authorised';
|
$string['auth_cas_invalidcaslogin'] = 'Sorry, your login has failed - you could not be authorised';
|
||||||
$string['auth_cas_server_settings'] = 'CAS server configuration';
|
$string['auth_cas_server_settings'] = 'CAS server configuration';
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
'allowuserthemes' => false,
|
'allowuserthemes' => false,
|
||||||
'allowuserblockhiding' => true,
|
'allowuserblockhiding' => true,
|
||||||
'allusersaresitestudents' => true,
|
'allusersaresitestudents' => true,
|
||||||
|
'alternateloginurl' => '',
|
||||||
'aspellpath' => '',
|
'aspellpath' => '',
|
||||||
'auth' => 'email',
|
'auth' => 'email',
|
||||||
'auth_pop3mailbox' => 'INBOX',
|
'auth_pop3mailbox' => 'INBOX',
|
||||||
|
|
|
@ -61,10 +61,10 @@
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$frm->username = $user->username;
|
$frm->username = $user->username;
|
||||||
} else {
|
} else {
|
||||||
$frm = data_submitted();
|
$frm = data_submitted($CFG->alternateloginurl);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$frm = data_submitted();
|
$frm = data_submitted($CFG->alternateloginurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
|
if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
|
||||||
|
@ -219,6 +219,11 @@
|
||||||
$show_instructions = false;
|
$show_instructions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($CFG->alternateloginurl)) {
|
||||||
|
redirect($CFG->alternateloginurl);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
|
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
|
||||||
include("index_form.html");
|
include("index_form.html");
|
||||||
print_footer();
|
print_footer();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue