Skip to content
Snippets Groups Projects
Commit e26aa211 authored by Pierre H. Lehnen's avatar Pierre H. Lehnen Committed by Rodrigo Nascimento
Browse files

[FIX] Wordpress oauth configuration not loading properly (#11187)

* Fixed issue were wordpress oauth configuration was not loaded properly

* different fix for the oauth configuration loading problem
parent daa53bfa
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,12 @@ const WordPress = new CustomOAuth('wordpress', config); ...@@ -15,6 +15,12 @@ const WordPress = new CustomOAuth('wordpress', config);
const fillSettings = _.debounce(Meteor.bindEnvironment(() => { const fillSettings = _.debounce(Meteor.bindEnvironment(() => {
config.serverURL = RocketChat.settings.get('API_Wordpress_URL'); config.serverURL = RocketChat.settings.get('API_Wordpress_URL');
if (!config.serverURL) {
if (config.serverURL === undefined) {
return fillSettings();
}
return;
}
delete config.identityPath; delete config.identityPath;
delete config.identityTokenSentVia; delete config.identityTokenSentVia;
...@@ -58,22 +64,23 @@ const fillSettings = _.debounce(Meteor.bindEnvironment(() => { ...@@ -58,22 +64,23 @@ const fillSettings = _.debounce(Meteor.bindEnvironment(() => {
} }
const result = WordPress.configure(config); const result = WordPress.configure(config);
if (Meteor.isServer) {
const enabled = RocketChat.settings.get('Accounts_OAuth_Wordpress'); const enabled = RocketChat.settings.get('Accounts_OAuth_Wordpress');
if (enabled) { if (enabled) {
ServiceConfiguration.configurations.upsert({ ServiceConfiguration.configurations.upsert({
service: 'wordpress' service: 'wordpress'
}, { }, {
$set: config $set: config
}); });
} else { } else {
ServiceConfiguration.configurations.remove({ ServiceConfiguration.configurations.remove({
service: 'wordpress' service: 'wordpress'
}); });
}
} }
return result; return result;
}), 1000); }), Meteor.isServer ? 1000 : 100);
if (Meteor.isServer) { if (Meteor.isServer) {
Meteor.startup(function() { Meteor.startup(function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment