久保田隼基 7 лет назад
Родитель
Сommit
af3dd5ea79
1 измененных файлов с 28 добавлено и 0 удалено
  1. 28 0
      lib/routes/admin.js

+ 28 - 0
lib/routes/admin.js

@@ -970,6 +970,34 @@ module.exports = function(crowi, app) {
     return res.json({status: true});
   };
 
+  actions.api.securityPassportTwitterSetting = async(req, res) => {
+    const form = req.form.settingForm;
+
+    if (!req.form.isValid) {
+      return res.json({status: false, message: req.form.errors.join('\n')});
+    }
+
+    debug('form content', form);
+    await saveSettingAsync(form);
+    const config = await crowi.getConfig();
+    
+
+    // // reset strategy
+    // await crowi.passportService.resetTwitterStrategy();
+    // // setup strategy
+    // if (Config.isEnabledPassportTwitter(config)) {
+    //   try {
+    //     await crowi.passportService.setupTwitterStrategy(true);
+    //   }
+    //   catch (err) {
+    //     // reset
+    //     await crowi.passportService.resetTwitterStrategy();
+    //     return res.json({status: false, message: err.message});
+    //   }
+    // }
+
+    return res.json({status: true});
+  };
   actions.api.customizeSetting = function(req, res) {
     const form = req.form.settingForm;