FIX: correct messages displayed when reseting password

This commit is contained in:
Joffrey JAFFEUX 2018-03-14 16:33:09 +01:00 committed by GitHub
parent fd7308e7f6
commit 2d0537b593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');