|
|
@@ -903,7 +903,31 @@ module.exports = function(crowi, app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- actions.api.securityPassportGoogleSetting = function(req, res) {
|
|
|
+ // actions.api.securityPassportGoogleSetting = function(req, res) {
|
|
|
+ // var form = req.form.settingForm;
|
|
|
+
|
|
|
+ // if (!req.form.isValid) {
|
|
|
+ // return res.json({status: false, message: req.form.errors.join('\n')});
|
|
|
+ // }
|
|
|
+
|
|
|
+ // debug('form content', form);
|
|
|
+ // return saveSettingAsync(form)
|
|
|
+ // .then(() => {
|
|
|
+ // const config = crowi.getConfig();
|
|
|
+
|
|
|
+ // // reset strategy
|
|
|
+ // crowi.passportService.resetGoogleStrategy();
|
|
|
+ // // setup strategy
|
|
|
+ // if (Config.isEnabledPassportGoogle(config)) {
|
|
|
+ // crowi.passportService.setupGoogleStrategy(true);
|
|
|
+ // }
|
|
|
+ // return;
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // res.json({status: true});
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ actions.api.securityPassportGoogleSetting = async function(req, res) {
|
|
|
var form = req.form.settingForm;
|
|
|
|
|
|
if (!req.form.isValid) {
|
|
|
@@ -911,21 +935,17 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
|
|
|
|
debug('form content', form);
|
|
|
- return saveSettingAsync(form)
|
|
|
- .then(() => {
|
|
|
- const config = crowi.getConfig();
|
|
|
+ await saveSettingAsync(form);
|
|
|
+ const config = await crowi.getConfig();
|
|
|
+
|
|
|
+ // reset strategy
|
|
|
+ await crowi.passportService.resetGoogleStrategy();
|
|
|
+ // setup strategy
|
|
|
+ if (Config.isEnabledPassportGoogle(config)) {
|
|
|
+ await crowi.passportService.setupGoogleStrategy(true);
|
|
|
+ }
|
|
|
|
|
|
- // reset strategy
|
|
|
- crowi.passportService.resetGoogleStrategy();
|
|
|
- // setup strategy
|
|
|
- if (Config.isEnabledPassportGoogle(config)) {
|
|
|
- crowi.passportService.setupGoogleStrategy(true);
|
|
|
- }
|
|
|
- return;
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- res.json({status: true});
|
|
|
- });
|
|
|
+ return res.json({status: true});
|
|
|
};
|
|
|
|
|
|
actions.api.customizeSetting = function(req, res) {
|