diff --git a/app/assets/javascripts/discourse/controllers/forgot_password_controller.js b/app/assets/javascripts/discourse/controllers/forgot_password_controller.js index c49e0cb6622..fd16ae467aa 100644 --- a/app/assets/javascripts/discourse/controllers/forgot_password_controller.js +++ b/app/assets/javascripts/discourse/controllers/forgot_password_controller.js @@ -15,6 +15,7 @@ Discourse.ForgotPasswordController = Discourse.Controller.extend(Discourse.Modal }.property('accountEmailOrUsername'), submit: function() { + if (!this.get('accountEmailOrUsername')) return false; Discourse.ajax("/session/forgot_password", { data: { login: this.get('accountEmailOrUsername') }, @@ -22,7 +23,11 @@ Discourse.ForgotPasswordController = Discourse.Controller.extend(Discourse.Modal }); // don't tell people what happened, this keeps it more secure (ensure same on server) - this.flash(I18n.t('forgot_password.complete')); + if (this.get('accountEmailOrUsername').match(/@/)) { + this.flash(I18n.t('forgot_password.complete_email', {email: this.get('accountEmailOrUsername')})); + } else { + this.flash(I18n.t('forgot_password.complete_username', {username: this.get('accountEmailOrUsername')})); + } return false; } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index c8d7760c342..ad3c59cb120 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -484,7 +484,8 @@ en: action: "I forgot my password" invite: "Enter your username or email address, and we'll send you a password reset email." reset: "Reset Password" - complete: "If an account matches that username or email address, you should receive an email with instructions on how to reset your password shortly." + complete_username: "If an account matches the username %{username}, you should receive an email with instructions on how to reset your password shortly." + complete_email: "If an account matches %{email}, you should receive an email with instructions on how to reset your password shortly." login: title: "Sign In"