mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 15:43:59 +08:00
Add specific error message when an email address is not found in forgot password modal
This commit is contained in:
parent
b55983c09e
commit
bf003ebe0c
12
framework/core/js/forum/dist/app.js
vendored
12
framework/core/js/forum/dist/app.js
vendored
|
@ -22110,12 +22110,22 @@ System.register('flarum/components/ForgotPasswordModal', ['flarum/components/Mod
|
||||||
app.request({
|
app.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: app.forum.attribute('apiUrl') + '/forgot',
|
url: app.forum.attribute('apiUrl') + '/forgot',
|
||||||
data: { email: this.email() }
|
data: { email: this.email() },
|
||||||
|
errorHandler: this.onerror.bind(this)
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
_this2.success = true;
|
_this2.success = true;
|
||||||
_this2.alert = null;
|
_this2.alert = null;
|
||||||
}).catch(function () {}).then(this.loaded.bind(this));
|
}).catch(function () {}).then(this.loaded.bind(this));
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onerror',
|
||||||
|
value: function onerror(error) {
|
||||||
|
if (error.status === 404) {
|
||||||
|
error.alert.props.children = app.translator.trans('core.forum.forgot_password.not_found_message');
|
||||||
|
}
|
||||||
|
|
||||||
|
babelHelpers.get(Object.getPrototypeOf(ForgotPasswordModal.prototype), 'onerror', this).call(this, error);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
return ForgotPasswordModal;
|
return ForgotPasswordModal;
|
||||||
}(Modal);
|
}(Modal);
|
||||||
|
|
|
@ -85,7 +85,8 @@ export default class ForgotPasswordModal extends Modal {
|
||||||
app.request({
|
app.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: app.forum.attribute('apiUrl') + '/forgot',
|
url: app.forum.attribute('apiUrl') + '/forgot',
|
||||||
data: {email: this.email()}
|
data: {email: this.email()},
|
||||||
|
errorHandler: this.onerror.bind(this)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
|
@ -94,4 +95,12 @@ export default class ForgotPasswordModal extends Modal {
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.then(this.loaded.bind(this));
|
.then(this.loaded.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onerror(error) {
|
||||||
|
if (error.status === 404) {
|
||||||
|
error.alert.props.children = app.translator.trans('core.forum.forgot_password.not_found_message');
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onerror(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user