Procházet zdrojové kódy

Merge pull request #3738 from weseek/fix/add-middleware

Fix/add middleware
Sizma yosimaz před 4 roky
rodič
revize
69f698623f

+ 2 - 3
src/server/routes/apiv3/slack-integration-settings.js

@@ -271,12 +271,13 @@ module.exports = (crowi) => {
    *           200:
    *           200:
    *             description: Succeeded to put CustomBotWithoutProxy setting.
    *             description: Succeeded to put CustomBotWithoutProxy setting.
    */
    */
-  router.put('/without-proxy/update-settings', async(req, res) => {
+  router.put('/without-proxy/update-settings', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
     const currentBotType = crowi.configManager.getConfig('crowi', 'slackbot:currentBotType');
     const currentBotType = crowi.configManager.getConfig('crowi', 'slackbot:currentBotType');
     if (currentBotType !== 'customBotWithoutProxy') {
     if (currentBotType !== 'customBotWithoutProxy') {
       const msg = 'Not CustomBotWithoutProxy';
       const msg = 'Not CustomBotWithoutProxy';
       return res.apiv3Err(new ErrorV3(msg, 'not-customBotWithoutProxy'), 400);
       return res.apiv3Err(new ErrorV3(msg, 'not-customBotWithoutProxy'), 400);
     }
     }
+
     const { slackSigningSecret, slackBotToken } = req.body;
     const { slackSigningSecret, slackBotToken } = req.body;
     const requestParams = {
     const requestParams = {
       'slackbot:signingSecret': slackSigningSecret,
       'slackbot:signingSecret': slackSigningSecret,
@@ -297,8 +298,6 @@ module.exports = (crowi) => {
       logger.error('Error', error);
       logger.error('Error', error);
       return res.apiv3Err(new ErrorV3(msg, 'update-CustomBotSetting-failed'), 500);
       return res.apiv3Err(new ErrorV3(msg, 'update-CustomBotSetting-failed'), 500);
     }
     }
-
-
   });
   });