From 589b78d5753cf40d85fd4ce7b5704f611a999ac7 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Tue, 30 Jul 2019 16:37:32 +0200 Subject: [PATCH] Added missing validator to updateSetup method - This is the code corresponding to processArgs function in v1 authentication.updateSetup method --- core/server/api/v2/utils/validators/input/index.js | 4 ++++ core/server/api/v2/utils/validators/input/setup.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 core/server/api/v2/utils/validators/input/setup.js diff --git a/core/server/api/v2/utils/validators/input/index.js b/core/server/api/v2/utils/validators/input/index.js index 014b3d988e..ade462c797 100644 --- a/core/server/api/v2/utils/validators/input/index.js +++ b/core/server/api/v2/utils/validators/input/index.js @@ -3,6 +3,10 @@ module.exports = { return require('./passwordreset'); }, + get setup() { + return require('./setup'); + }, + get posts() { return require('./posts'); }, diff --git a/core/server/api/v2/utils/validators/input/setup.js b/core/server/api/v2/utils/validators/input/setup.js new file mode 100644 index 0000000000..3dc8dd32b9 --- /dev/null +++ b/core/server/api/v2/utils/validators/input/setup.js @@ -0,0 +1,12 @@ +const debug = require('ghost-ignition').debug('api:v2:utils:validators:input:updateSetup'); +const common = require('../../../../../lib/common'); + +module.exports = { + updateSetup(apiConfig, frame) { + debug('resetPassword'); + + if (!frame.options.context || !frame.options.context.user) { + throw new common.errors.NoPermissionError({message: common.i18n.t('errors.api.authentication.notTheBlogOwner')}); + } + } +};