|
@@ -899,7 +899,7 @@ module.exports = function(crowi, app) {
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- await crowi.configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
return res.json({ status: true });
|
|
return res.json({ status: true });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
@@ -948,7 +948,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- return saveSettingAsync(form)
|
|
|
|
|
|
|
+ return configManager.updateConfigsInTheSameNamespace('crowi', form)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
crowi.passportService.resetLdapStrategy();
|
|
crowi.passportService.resetLdapStrategy();
|
|
@@ -973,12 +973,12 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- await crowi.configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
await crowi.passportService.resetSamlStrategy();
|
|
await crowi.passportService.resetSamlStrategy();
|
|
|
// setup strategy
|
|
// setup strategy
|
|
|
- if (crowi.configManager.getConfig('crowi', 'security:passport-saml:isEnabled')) {
|
|
|
|
|
|
|
+ if (configManager.getConfig('crowi', 'security:passport-saml:isEnabled')) {
|
|
|
try {
|
|
try {
|
|
|
await crowi.passportService.setupSamlStrategy(true);
|
|
await crowi.passportService.setupSamlStrategy(true);
|
|
|
}
|
|
}
|
|
@@ -1000,7 +1000,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- await saveSettingAsync(form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
await crowi.passportService.resetGoogleStrategy();
|
|
await crowi.passportService.resetGoogleStrategy();
|
|
@@ -1027,7 +1027,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- await saveSettingAsync(form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
await crowi.passportService.resetGitHubStrategy();
|
|
await crowi.passportService.resetGitHubStrategy();
|
|
@@ -1054,7 +1054,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- await saveSettingAsync(form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
await crowi.passportService.resetTwitterStrategy();
|
|
await crowi.passportService.resetTwitterStrategy();
|
|
@@ -1081,7 +1081,7 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
debug('form content', form);
|
|
debug('form content', form);
|
|
|
- await saveSettingAsync(form);
|
|
|
|
|
|
|
+ await configManager.updateConfigsInTheSameNamespace('crowi', form);
|
|
|
|
|
|
|
|
// reset strategy
|
|
// reset strategy
|
|
|
await crowi.passportService.resetOidcStrategy();
|
|
await crowi.passportService.resetOidcStrategy();
|
|
@@ -1376,25 +1376,6 @@ module.exports = function(crowi, app) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * save settings, update config cache ONLY. (this method don't response json)
|
|
|
|
|
- *
|
|
|
|
|
- * @param {any} form
|
|
|
|
|
- * @returns
|
|
|
|
|
- */
|
|
|
|
|
- function saveSettingAsync(form) {
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- Config.updateNamespaceByArray('crowi', form, (err, config) => {
|
|
|
|
|
- if (err) {
|
|
|
|
|
- return reject(err);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Config.updateConfigCache('crowi', config);
|
|
|
|
|
- return resolve();
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function validateMailSetting(req, form, callback) {
|
|
function validateMailSetting(req, form, callback) {
|
|
|
const mailer = crowi.mailer;
|
|
const mailer = crowi.mailer;
|
|
|
const option = {
|
|
const option = {
|
|
@@ -1431,7 +1412,7 @@ module.exports = function(crowi, app) {
|
|
|
function validateSamlSettingForm(form, t) {
|
|
function validateSamlSettingForm(form, t) {
|
|
|
for (const key of crowi.passportService.mandatoryConfigKeysForSaml) {
|
|
for (const key of crowi.passportService.mandatoryConfigKeysForSaml) {
|
|
|
const formValue = form.settingForm[key];
|
|
const formValue = form.settingForm[key];
|
|
|
- if (crowi.configManager.getConfigFromEnvVars('crowi', key) === null && formValue === '') {
|
|
|
|
|
|
|
+ if (configManager.getConfigFromEnvVars('crowi', key) === null && formValue === '') {
|
|
|
const formItemName = t(`security_setting.form_item_name.${key}`);
|
|
const formItemName = t(`security_setting.form_item_name.${key}`);
|
|
|
form.errors.push(t('form_validation.required', formItemName));
|
|
form.errors.push(t('form_validation.required', formItemName));
|
|
|
}
|
|
}
|