mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Replaced i18n.t w/ tpl helper in authorize.js (#13442)
refs: #13380 - The i18n package is deprecated. It is being replaced with the tpl package. Co-authored-by: Aleksander Chromik <aleksander.chromik@footballco.com>
This commit is contained in:
parent
045ce4834c
commit
b69c39ba13
@ -1,5 +1,11 @@
|
||||
const errors = require('@tryghost/errors');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
||||
const messages = {
|
||||
authorizationFailed: 'Authorization failed',
|
||||
missingContentMemberOrIntegration: 'Unable to determine the authenticated member or integration. Check the supplied Content API Key and ensure cookies are being passed through if member auth is failing.',
|
||||
missingAdminUserOrIntegration: 'Unable to determine the authenticated user or integration. Check that cookies are being passed through if using session authentication.'
|
||||
};
|
||||
|
||||
const authorize = {
|
||||
authorizeContentApi(req, res, next) {
|
||||
@ -12,8 +18,8 @@ const authorize = {
|
||||
return next();
|
||||
}
|
||||
return next(new errors.NoPermissionError({
|
||||
message: i18n.t('errors.middleware.auth.authorizationFailed'),
|
||||
context: i18n.t('errors.middleware.auth.missingContentMemberOrIntegration')
|
||||
message: tpl(messages.authorizationFailed),
|
||||
context: tpl(messages.missingContentMemberOrIntegration)
|
||||
}));
|
||||
},
|
||||
|
||||
@ -25,8 +31,8 @@ const authorize = {
|
||||
return next();
|
||||
} else {
|
||||
return next(new errors.NoPermissionError({
|
||||
message: i18n.t('errors.middleware.auth.authorizationFailed'),
|
||||
context: i18n.t('errors.middleware.auth.missingAdminUserOrIntegration')
|
||||
message: tpl(messages.authorizationFailed),
|
||||
context: tpl(messages.missingAdminUserOrIntegration)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user