From cef32dd1fe028e14c013f72e572a96001f7d9ef0 Mon Sep 17 00:00:00 2001 From: Indrakant Dana <60315832+Indrakant-Dana@users.noreply.github.com> Date: Tue, 12 Oct 2021 00:26:23 +0530 Subject: [PATCH] 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. --- .../api/v3/utils/validators/input/passwordreset.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/server/api/v3/utils/validators/input/passwordreset.js b/core/server/api/v3/utils/validators/input/passwordreset.js index 49cb5bf400..0605de5bf7 100644 --- a/core/server/api/v3/utils/validators/input/passwordreset.js +++ b/core/server/api/v3/utils/validators/input/passwordreset.js @@ -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) }); } }