Better forgot password message

This commit is contained in:
Neil Lalonde 2014-05-05 13:48:11 -04:00
parent 23cc7c174a
commit a15714899e
2 changed files with 8 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 <b>%{username}</b>, you should receive an email with instructions on how to reset your password shortly."
complete_email: "If an account matches <b>%{email}</b>, you should receive an email with instructions on how to reset your password shortly."
login:
title: "Sign In"