itizawa 6 лет назад
Родитель
Сommit
15797a2d85
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      src/server/routes/apiv3/personal-setting.js

+ 10 - 2
src/server/routes/apiv3/personal-setting.js

@@ -76,6 +76,14 @@ module.exports = (crowi) => {
           return (value === req.body.newPassword);
         }),
     ],
+    associateLdap: [
+      body('username').isString().not().isEmpty(),
+      body('password').isString().not().isEmpty(),
+    ],
+    disassociateLdap: [
+      body('providerType').isString().not().isEmpty(),
+      body('accountId').isString().not().isEmpty(),
+    ],
   };
 
   /**
@@ -295,7 +303,7 @@ module.exports = (crowi) => {
   });
 
   // TODO swagger
-  router.put('/associate-ldap', loginRequiredStrictly, csrf, async(req, res) => {
+  router.put('/associate-ldap', accessTokenParser, loginRequiredStrictly, csrf, validator.associateLdap, ApiV3FormValidator, async(req, res) => {
     const { passportService } = crowi;
     const { user, body } = req;
     const { username } = body;
@@ -318,7 +326,7 @@ module.exports = (crowi) => {
   });
 
   // TODO swagger
-  router.put('/disassociate-ldap', loginRequiredStrictly, csrf, async(req, res) => {
+  router.put('/disassociate-ldap', accessTokenParser, loginRequiredStrictly, csrf, validator.disassociateLdap, ApiV3FormValidator, async(req, res) => {
     const { user, body } = req;
     const { providerType, accountId } = body;