Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-23692 forgotpw: Improve failure notices.

  • Loading branch information...
commit 4f3f6524e8f407073eff02c013b33db33047e87f 1 parent f888862
peterbulmer peterbulmer authored
Showing with 13 additions and 5 deletions.
  1. +5 −0 lang/en/moodle.php
  2. +8 −5 login/lib.php
5 lang/en/moodle.php
View
@@ -606,6 +606,11 @@
$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.';
13 login/lib.php
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.