mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 07:42:11 +08:00
FIX: correct messages displayed when reseting password
This commit is contained in:
parent
fd7308e7f6
commit
2d0537b593
@ -41,16 +41,25 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
const accountEmailOrUsername = escapeExpression(this.get("accountEmailOrUsername"));
|
||||
const isEmail = accountEmailOrUsername.match(/@/);
|
||||
let key = `forgot_password.complete_${isEmail ? 'email' : 'username'}`;
|
||||
if (data.user_found) {
|
||||
this.set('offerHelp', I18n.t(`${key}_found`, {
|
||||
let extraClass;
|
||||
|
||||
if (data.user_found === true) {
|
||||
key += '_found';
|
||||
this.set('accountEmailOrUsername', '');
|
||||
this.set('offerHelp', I18n.t(key, {
|
||||
email: accountEmailOrUsername,
|
||||
username: accountEmailOrUsername
|
||||
}));
|
||||
} else {
|
||||
this.flash(I18n.t(`${key}_not_found`, {
|
||||
if (data.user_found === false) {
|
||||
key += '_not_found';
|
||||
extraClass = 'error';
|
||||
}
|
||||
|
||||
this.flash(I18n.t(key, {
|
||||
email: accountEmailOrUsername,
|
||||
username: accountEmailOrUsername
|
||||
}), 'error');
|
||||
}), extraClass);
|
||||
}
|
||||
}).catch(e => {
|
||||
this.flash(extractError(e), 'error');
|
||||
|
Loading…
x
Reference in New Issue
Block a user