mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Replaced i18n.t w/ tpl in core/server/api/v3/utils/validators/input/passwordreset.js (#13532)
refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
parent
a73459d904
commit
cef32dd1fe
@ -1,9 +1,14 @@
|
||||
const Promise = require('bluebird');
|
||||
const validator = require('@tryghost/validator');
|
||||
const debug = require('@tryghost/debug')('api:v3:utils:validators:input:passwordreset');
|
||||
const i18n = require('../../../../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
const messages = {
|
||||
newPasswordsDoNotMatch: 'Your new passwords do not match',
|
||||
invalidEmailReceived: 'The server did not receive a valid email'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
resetPassword(apiConfig, frame) {
|
||||
debug('resetPassword');
|
||||
@ -12,7 +17,7 @@ module.exports = {
|
||||
|
||||
if (data.newPassword !== data.ne2Password) {
|
||||
return Promise.reject(new errors.ValidationError({
|
||||
message: i18n.t('errors.models.user.newPasswordsDoNotMatch')
|
||||
message: tpl(messages.newPasswordsDoNotMatch)
|
||||
}));
|
||||
}
|
||||
},
|
||||
@ -24,7 +29,7 @@ module.exports = {
|
||||
|
||||
if (typeof email !== 'string' || !validator.isEmail(email)) {
|
||||
throw new errors.BadRequestError({
|
||||
message: i18n.t('errors.api.authentication.invalidEmailReceived')
|
||||
message: tpl(messages.invalidEmailReceived)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user