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:
Indrakant Dana 2021-10-12 00:26:23 +05:30 committed by GitHub
parent a73459d904
commit cef32dd1fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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