|
|
@@ -918,7 +918,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- actions.api.securityPassportLdapSetting = function(req, res) {
|
|
|
+ actions.api.securityPassportLdapSetting = async function(req, res) {
|
|
|
const form = req.form.settingForm;
|
|
|
|
|
|
if (!req.form.isValid) {
|
|
|
@@ -926,19 +926,22 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
|
|
|
|
debug('form content', form);
|
|
|
- return configManager.updateConfigsInTheSameNamespace('crowi', form)
|
|
|
- .then(() => {
|
|
|
- // reset strategy
|
|
|
- crowi.passportService.resetLdapStrategy();
|
|
|
- // setup strategy
|
|
|
- if (configManager.getConfig('crowi', 'security:passport-ldap:isEnabled')) {
|
|
|
- crowi.passportService.setupLdapStrategy(true);
|
|
|
- }
|
|
|
- return;
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- res.json({ status: true });
|
|
|
- });
|
|
|
+
|
|
|
+ try {
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
+ // reset strategy
|
|
|
+ crowi.passportService.resetLdapStrategy();
|
|
|
+ // setup strategy
|
|
|
+ if (configManager.getConfig('crowi', 'security:passport-ldap:isEnabled')) {
|
|
|
+ crowi.passportService.setupLdapStrategy(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ logger.error(err);
|
|
|
+ return res.json({ status: false, message: err.message });
|
|
|
+ }
|
|
|
+
|
|
|
+ return res.json({ status: true });
|
|
|
};
|
|
|
|
|
|
actions.api.securityPassportSamlSetting = async(req, res) => {
|