MDL-23692 forgotpw: Improve failure notices.

This commit is contained in:
Peter Bulmer 2013-07-26 15:22:00 +12:00
parent f888862eb0
commit 4f3f6524e8
2 changed files with 13 additions and 5 deletions

View File

@ -606,6 +606,11 @@ $string['emailpasswordconfirmationsubject'] = '{$a}: Change password confirmatio
$string['emailpasswordconfirmmaybesent'] = '<p>If you supplied a correct username or email address then an email should have been sent to you.</p>
<p>It contains easy instructions to confirm and complete this password change.
If you continue to have difficulty, please contact the site administrator.</p>';
$string['emailpasswordconfirmnoemail'] = '<p>The user account you specified does not have a recorded email address.</p>
<p>Please contact the site administrator.</p>';
$string['emailpasswordconfirmnotsent'] = '<p>The user detail you supplied does not identify an existing user account.</p>
<p>Please check the detail you entered, then try again.
If you continue to have difficulty, please contact the site administrator.</p>';
$string['emailpasswordconfirmsent'] = 'An email should have been sent to your address at <b>{$a}</b>.
<br />It contains easy instructions to confirm and complete this password change.
If you continue to have difficulty, contact the site administrator.';

View File

@ -71,11 +71,14 @@ function forgotpw_process_request() {
// Print general (non-commital) message
notice(get_string('emailpasswordconfirmmaybesent'), $CFG->wwwroot.'/index.php');
die; // never reached
} elseif (empty($user) || empty($user->email)) {
// Protect usernames is off, and we either couldn't find the user, or they don't have an email set.
// Still print non-commital message
// This is a big usability problem - need to tell users when we couldn't find the details they requested.
notice(get_string('emailpasswordconfirmmaybesent'), $CFG->wwwroot.'/index.php');
} elseif (empty($user)) {
// Protect usernames is off, and we couldn't find the user with details specified.
// Print failure advice:
notice(get_string('emailpasswordconfirmnotsent'), $CFG->wwwroot.'/forgot_password.php');
die; // never reached
} elseif (empty($user->email)) {
// User doesn't have an email set - can't send a password change confimation email.
notice(get_string('emailpasswordconfirmnoemail'), $CFG->wwwroot.'/index.php');
die; // never reached
} elseif ($pwresetstatus == PWRESET_STATUS_NOEMAILSENT) {
// User found, protectusernames is off, but user is not confirmed