Skip to content

Commit

Permalink
Merge pull request #1 from geekgonecrazy/fix-github-ee
Browse files Browse the repository at this point in the history
Fix GitHub Enterprise oauth
  • Loading branch information
Lee Faus committed Oct 1, 2015
2 parents 82c4645 + 677f9f7 commit 0efbd9e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/rocketchat-github-enterprise/common.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
config =
serverURL: ''
identityPath: '/api/v3/user'
authorizePath: '/login/oauth/authorize'
tokenPath: '/login/oauth/access_token'
addAutopublishFields:
forLoggedInUser: ['services.github-enterprise']
forOtherUsers: ['services.github-enterprise.username']

GitHubEnterprise = new CustomOAuth 'github-enterprise', config
GitHubEnterprise = new CustomOAuth 'github_enterprise', config

if Meteor.isServer
Meteor.startup ->
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions packages/rocketchat-lib/settings/server/updateServices.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ updateServices = ->
Meteor.clearTimeout timer if timer?

timer = Meteor.setTimeout ->
services = RocketChat.models.Settings.find({_id: /^(Accounts_OAuth_|Accounts_OAuth_Custom_)[a-z]+$/i}).fetch()

services = RocketChat.models.Settings.find({_id: /^(Accounts_OAuth_|Accounts_OAuth_Custom_)[a-z_-]+$/i}).fetch()
for service in services
console.log "Updating login service #{service._id}".blue

Expand All @@ -21,6 +20,7 @@ updateServices = ->
clientId: RocketChat.models.Settings.findOneById("#{service._id}_id")?.value
secret: RocketChat.models.Settings.findOneById("#{service._id}_secret")?.value


if /Accounts_OAuth_Custom_/.test service._id
data.custom = true
data.serverURL = RocketChat.models.Settings.findOneById("#{service._id}_url")?.value
Expand All @@ -43,7 +43,6 @@ updateServices = ->
if serviceName is 'Twitter'
data.consumerKey = data.clientId
delete data.clientId

ServiceConfiguration.configurations.upsert {service: serviceName.toLowerCase()}, $set: data
else
ServiceConfiguration.configurations.remove {service: serviceName.toLowerCase()}
Expand Down

0 comments on commit 0efbd9e

Please sign in to comment.