Permalink
Browse files

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.
  • Loading branch information...
1 parent f4cbf7f commit 5b2ae5848c5edddbe33368b5eccb0c9399e70e99 ikawhero committed Apr 1, 2005
Showing with 29 additions and 2 deletions.
  1. +19 −0 admin/auth.php
  2. +2 −0 lang/en/auth.php
  3. +1 −0 lib/defaults.php
  4. +7 −2 login/index.php
View
@@ -61,6 +61,9 @@
if (! isset($config->guestloginbutton)) {
$config->guestloginbutton = 1;
}
+ if (! isset($config->alternateloginurl)) {
+ $config->alternateloginurl = '';
+ }
if (! isset($config->auth_instructions)) {
$config->auth_instructions = "";
}
@@ -160,6 +163,22 @@
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 '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
echo '</form>';
View
@@ -2,6 +2,8 @@
// 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_invalidcaslogin'] = 'Sorry, your login has failed - you could not be authorised';
$string['auth_cas_server_settings'] = 'CAS server configuration';
View
@@ -10,6 +10,7 @@
'allowuserthemes' => false,
'allowuserblockhiding' => true,
'allusersaresitestudents' => true,
+ 'alternateloginurl' => '',
'aspellpath' => '',
'auth' => 'email',
'auth_pop3mailbox' => 'INBOX',
View
@@ -61,10 +61,10 @@
if ($user) {
$frm->username = $user->username;
} else {
- $frm = data_submitted();
+ $frm = data_submitted($CFG->alternateloginurl);
}
} else {
- $frm = data_submitted();
+ $frm = data_submitted($CFG->alternateloginurl);
}
if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
@@ -218,6 +218,11 @@
} else {
$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>");
include("index_form.html");

0 comments on commit 5b2ae58

Please sign in to comment.