]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11977:
authorthepurpleblob <thepurpleblob>
Thu, 1 Nov 2007 14:37:51 +0000 (14:37 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 1 Nov 2007 14:37:51 +0000 (14:37 +0000)
Add an an optional forgotten password handling url

Merged from STABLE_19

admin/auth.php
lang/en_utf8/auth.php
login/forgot_password.php

index fabfa5e69dcae5758ddc8cdb03f8fc666b54c341..b36655180fd652117aaddf51431b3dcedfc45d9d 100644 (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">';
index 0987eb8a07d4cad64d5c2ac18500c3bc6e1e9699..6837ba1e2613dcbeee689be73dd0d7fa7f1607b9 100644 (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.';
index 50d8a1102718b9a0b8e4beac17f58af01d3712fe..286729db1d497d365b9eb14557dd69ffb8f04112 100644 (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);