diff --git a/HISTORY.md b/HISTORY.md index 8bf79ef561d951495448abcfdfba432c5d51d8c1..b98df65cdc6ed3e29f8e2abb7e928a6b0084a9a6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -200,7 +200,7 @@ - Enable editing via admin / users - Log error when trigger url returns 500 - Bind starttls correctly for LDAP -- Custom oAuth supporting json or plain content_types responses of the identity +- Custom OAuth supporting json or plain content_types responses of the identity - Allow pass room id to direct rooms - Outgoing: Get the room from posted message to reply - Change Meteor.absoluteUrl to force SSL if Force_SSL is true @@ -529,7 +529,7 @@ - New RocketChat.RateLimiter - Favico.js update - Better RTL support -- Remove custom oAuth record when removed from settings +- Remove custom OAuth record when removed from settings - Improve Settings layout - Collapse sub groups of settings - Change translations in PT for False and True diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee index 28e69f233f35c2a540ae6dcbcb8c9af78c1bcd7c..6be8d313f6093582cc70a823aedb95fa4823ae91 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee +++ b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee @@ -110,7 +110,7 @@ class CustomOAuth console.log 'id:', JSON.stringify identity, null, ' ' serviceData = - _oAuthCustom: true + _OAuthCustom: true accessToken: accessToken _.extend serviceData, identity diff --git a/packages/rocketchat-github-enterprise/startup.coffee b/packages/rocketchat-github-enterprise/startup.coffee index a9c8c2f336b08b3f6651ef8ee2fb209ce1d0e6c6..c92b9b3dd003c7da987228be12a06d14d71e5c68 100644 --- a/packages/rocketchat-github-enterprise/startup.coffee +++ b/packages/rocketchat-github-enterprise/startup.coffee @@ -1,4 +1,4 @@ -RocketChat.settings.addGroup 'Accounts', -> +RocketChat.settings.addGroup 'OAuth', -> @section 'GitHub Enterprise', -> enableQuery = {_id: 'Accounts_OAuth_GitHub_Enterprise', value: true} @add 'Accounts_OAuth_GitHub_Enterprise', false, {type: 'boolean'} diff --git a/packages/rocketchat-gitlab/startup.coffee b/packages/rocketchat-gitlab/startup.coffee index 6f86e0578be3aa0bbc4c2175ac00738ddf0e0e11..b501316b1c9292085f1f3eb77036a768d2f9c562 100644 --- a/packages/rocketchat-gitlab/startup.coffee +++ b/packages/rocketchat-gitlab/startup.coffee @@ -1,4 +1,4 @@ -RocketChat.settings.addGroup 'Accounts', -> +RocketChat.settings.addGroup 'OAuth', -> @section 'GitLab', -> enableQuery = {_id: 'Accounts_OAuth_Gitlab', value: true} @add 'Accounts_OAuth_Gitlab', false, { type: 'boolean', public: true } diff --git a/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee b/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee index 5a8e1186c00264958207f700d4b460c477a91d08..4a5fbbdf96e24c290e247ad0d011a38d5755eaa3 100644 --- a/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee +++ b/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee @@ -4,7 +4,7 @@ logger = new Logger 'rocketchat:lib', type: 'info' timer = undefined -oAuthServicesUpdate = -> +OAuthServicesUpdate = -> Meteor.clearTimeout timer if timer? timer = Meteor.setTimeout -> @@ -55,7 +55,7 @@ oAuthServicesUpdate = -> , 2000 -oAuthServicesRemove = (_id) -> +OAuthServicesRemove = (_id) -> serviceName = _id.replace('Accounts_OAuth_Custom_', '') ServiceConfiguration.configurations.remove {service: serviceName.toLowerCase()} @@ -63,12 +63,12 @@ oAuthServicesRemove = (_id) -> RocketChat.models.Settings.find().observe added: (record) -> if /^Accounts_OAuth_.+/.test record._id - oAuthServicesUpdate() + OAuthServicesUpdate() changed: (record) -> if /^Accounts_OAuth_.+/.test record._id - oAuthServicesUpdate() + OAuthServicesUpdate() removed: (record) -> if /^Accounts_OAuth_Custom.+/.test record._id - oAuthServicesRemove record._id + OAuthServicesRemove record._id diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee index f085d669fad4d453c153a157a975c66bb2492202..14d790763eea4d17734ccfd485af59f0ae9de09b 100644 --- a/packages/rocketchat-lib/server/startup/settings.coffee +++ b/packages/rocketchat-lib/server/startup/settings.coffee @@ -31,7 +31,7 @@ RocketChat.settings.addGroup 'Accounts', -> @add 'Accounts_AvatarStoreType', 'GridFS', { type: 'select', values: [ { key: 'GridFS', i18nLabel: 'GridFS' }, { key: 'FileSystem', i18nLabel: 'FileSystem' } ] } @add 'Accounts_AvatarStorePath', '', { type: 'string', enableQuery: {_id: 'Accounts_AvatarStoreType', value: 'FileSystem'} } -RocketChat.settings.addGroup 'oAuth', -> +RocketChat.settings.addGroup 'OAuth', -> @section 'Facebook', -> @add 'Accounts_OAuth_Facebook', false, { type: 'boolean', public: true } diff --git a/packages/rocketchat-wordpress/startup.coffee b/packages/rocketchat-wordpress/startup.coffee index 1386cc1c024b7620772eb788b01ae49a7dcd46a1..d52d82dadf4236e8d28425c58335eb331777d5cf 100644 --- a/packages/rocketchat-wordpress/startup.coffee +++ b/packages/rocketchat-wordpress/startup.coffee @@ -1,6 +1,9 @@ -RocketChat.settings.add 'API_Wordpress_URL', '', { type: 'string', group: 'Accounts', public: true, section: 'WordPress' } -RocketChat.settings.add 'Accounts_OAuth_Wordpress', false, { type: 'boolean', group: 'Accounts', section: 'WordPress' } -RocketChat.settings.add 'Accounts_OAuth_Wordpress_id', '', { type: 'string', group: 'Accounts', section: 'WordPress' } -RocketChat.settings.add 'Accounts_OAuth_Wordpress_secret', '', { type: 'string', group: 'Accounts', section: 'WordPress' } -RocketChat.settings.add 'Accounts_OAuth_Wordpress_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/wordpress', { type: 'string', blocked: true } +RocketChat.settings.addGroup 'OAuth', -> + @section 'WordPress', -> + enableQuery = {_id: 'Accounts_OAuth_Wordpress', value: true} + @add 'Accounts_OAuth_Wordpress', false, { type: 'boolean', public: true } + @add 'API_Wordpress_URL', '', { type: 'string', enableQuery: enableQuery, public: true } + @add 'Accounts_OAuth_Wordpress_id', '', { type: 'string', enableQuery: enableQuery } + @add 'Accounts_OAuth_Wordpress_secret', '', { type: 'string', enableQuery: enableQuery } + @add 'Accounts_OAuth_Wordpress_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/wordpress', { type: 'string', blocked: true } diff --git a/server/configuration/accounts_meld.coffee b/server/configuration/accounts_meld.coffee index 69680727cbfbff0b0522d5f40c9add12863c220b..ab4ac6ab5eff81d9055f15063668e7f596e9d688 100644 --- a/server/configuration/accounts_meld.coffee +++ b/server/configuration/accounts_meld.coffee @@ -1,7 +1,7 @@ orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService Accounts.updateOrCreateUserFromExternalService = (serviceName, serviceData, options) -> - if serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._oAuthCustom isnt true + if serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._OAuthCustom isnt true return if serviceName is 'meteor-developer'