Skip to content
Snippets Groups Projects
Commit b14954ab authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Close #861; Fix Gitlab oAuth url from API_Gitlab_URL

parent 0d8bf597
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,13 @@ class CustomOAuth
if not Match.test @name, String
return throw new Meteor.Error 'CustomOAuth: Name is required and must be String'
@configure options
Accounts.oauth.registerService @name
@configureLogin()
configure: (options) ->
if not Match.test options, Object
return throw new Meteor.Error 'CustomOAuth: Options is required and must be Object'
......@@ -20,13 +27,9 @@ class CustomOAuth
@serverURL = options.serverURL
if not /^https?:\/\/.+/.test options.authorizePath
options.authorizePath = @serverURL + options.authorizePath
@authorizePath = options.authorizePath
Accounts.oauth.registerService @name
@configureLogin()
@authorizePath = @serverURL + options.authorizePath
else
@authorizePath = options.authorizePath
configureLogin: ->
self = @
......
Gitlab = new CustomOAuth 'gitlab',
config =
serverURL: 'https://gitlab.com'
identityPath: '/api/v3/user'
addAutopublishFields:
forLoggedInUser: ['services.gitlab']
forOtherUsers: ['services.gitlab.username']
Gitlab = new CustomOAuth 'gitlab', config
Meteor.startup ->
Tracker.autorun ->
if RocketChat.settings.get 'API_Gitlab_URL'
Gitlab.serverURL = RocketChat.settings.get 'API_Gitlab_URL'
config.serverURL = RocketChat.settings.get 'API_Gitlab_URL'
Gitlab.configure config
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