MDL-11977:

Add an an optional forgotten password handling url

Merged from STABLE_19
This commit is contained in:
thepurpleblob
2007-11-01 14:37:51 +00:00
parent 2f39c5ef5e
commit fcd0ddbfba
3 changed files with 19 additions and 1 deletions
+12 -1
View File
@@ -59,6 +59,7 @@ switch ($action) {
// save settings
set_config('guestloginbutton', required_param('guestloginbutton', PARAM_BOOL));
set_config('alternateloginurl', stripslashes(trim(required_param('alternateloginurl', PARAM_RAW))));
set_config('forgottenpasswordurl', stripslashes(trim(required_param('forgottenpasswordurl', PARAM_RAW))));
set_config('registerauth', required_param('register', PARAM_SAFEDIR));
set_config('auth_instructions', stripslashes(trim(required_param('auth_instructions', PARAM_RAW))));
@@ -289,10 +290,20 @@ echo '<div class="form-item" id="admin-alternateloginurl">';
echo '<label for = "alternateloginurl">' . get_string("alternateloginurl", "auth");
echo '<span class="form-shortname">alternateloginurl</span>';
echo '</label>';
echo '<input type="text" size="60" name="alternateloginurl" id="alternateloginurl" value="'.$CFG->alternateloginurl."\" />\n";
echo '<input type="text" size="60" name="alternateloginurl" id="alternateloginurl" value="'.s($CFG->alternateloginurl)."\" />\n";
echo '<div class="description">' . get_string("alternatelogin", "auth", htmlspecialchars($CFG->wwwroot.'/login/index.php')) . '</div>';
echo '</div>';
/// An alternate url for lost passwords. It means we can use external lost password
/// recovery for all users. Effectively disables built-in processes!!!
echo '<div class="form-item" id="admin-forgottenpasswordurl">';
echo '<label for = "forgottenpasswordurl">' . get_string("forgottenpasswordurl", "auth");
echo '<span class="form-shortname">forgottenpasswordurl</span>';
echo '</label>';
echo '<input type="text" size="60" name="forgottenpasswordurl" id="forgottenpasswordurl" value="'.s($CFG->forgottenpasswordurl)."\" />\n";
echo '<div class="description">' . get_string("forgottenpassword", "auth" ) . '</div>';
echo '</div>';
/// Instructions about login/password
/// to be showed to users
echo '<div class="form-item" id="admin-auth_instructions">';
+2
View File
@@ -4,6 +4,8 @@
$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['forgottenpassword'] = 'If you enter a URL here, it will be used as the lost password recovery page for this site. This is intended for sites where passwords are handled entirely outside of Moodle. Leave this blank to use the default password recovery.';
$string['forgottenpasswordurl'] = 'Forgotten password URL';
$string['pluginnotenabled'] = 'Authentication plugin \'$a\' is not enabled.';
$string['pluginnotinstalled'] = 'Authentication plugin \'$a\' is not installed.';
+5
View File
@@ -21,6 +21,11 @@ $strlogin = get_string('login');
$navigation = build_navigation(array(array('name' => $strlogin, 'link' => "$CFG->wwwroot/login/index.php", 'type' => 'misc'),
array('name' => $strforgotten, 'link' => null, 'type' => 'misc')));
// if alternatepasswordurl is defined, then we'll just head there
if (!empty($CFG->forgottenpasswordurl)) {
redirect($CFG->forgottenpasswordurl);
}
// if you are logged in then you shouldn't be here!
if (isloggedin() and !isguestuser()) {
redirect($CFG->wwwroot.'/index.php', get_string('loginalready'), 5);