From 915e268e6252fb3443ae679969e602988e28f3cb Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 1 Nov 2007 14:36:25 +0000 Subject: [PATCH] MDL-11977: Add an an optional forgotten password handling url --- admin/auth.php | 13 ++++++++++++- lang/en_utf8/auth.php | 2 ++ login/forgot_password.php | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/admin/auth.php b/admin/auth.php index fabfa5e69..b36655180 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -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 '
'; echo ''; -echo '\n"; +echo '\n"; echo '
' . get_string("alternatelogin", "auth", htmlspecialchars($CFG->wwwroot.'/login/index.php')) . '
'; echo '
'; +/// An alternate url for lost passwords. It means we can use external lost password +/// recovery for all users. Effectively disables built-in processes!!! +echo '
'; +echo ''; +echo '\n"; +echo '
' . get_string("forgottenpassword", "auth" ) . '
'; +echo '
'; + /// Instructions about login/password /// to be showed to users echo '
'; diff --git a/lang/en_utf8/auth.php b/lang/en_utf8/auth.php index 0987eb8a0..6837ba1e2 100644 --- a/lang/en_utf8/auth.php +++ b/lang/en_utf8/auth.php @@ -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 \'$a\' and return fields username and password.
Be careful not to enter an incorrect URL as you may lock yourself out of this site.
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.'; diff --git a/login/forgot_password.php b/login/forgot_password.php index 50d8a1102..286729db1 100644 --- a/login/forgot_password.php +++ b/login/forgot_password.php @@ -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); -- 2.11.4.GIT