Skip to content
Snippets Groups Projects
Commit 81ade7ca authored by Diego Sampaio's avatar Diego Sampaio
Browse files

Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into develop

parents 2c8ceaee 1e2fdf89
No related branches found
No related tags found
No related merge requests found
......@@ -5,4 +5,4 @@ RocketChat.settings.addGroup 'OAuth', ->
@add 'API_GitHub_Enterprise_URL', '', { type: 'string', public: true, enableQuery: enableQuery, i18nDescription: 'API_GitHub_Enterprise_URL_Description' }
@add 'Accounts_OAuth_GitHub_Enterprise_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_GitHub_Enterprise_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_GitHub_Enterprise_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/github_enterprise', { type: 'string', blocked: true }
@add 'Accounts_OAuth_GitHub_Enterprise_callback_url', '_oauth/github_enterprise', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
......@@ -5,4 +5,4 @@ RocketChat.settings.addGroup 'OAuth', ->
@add 'API_Gitlab_URL', '', { type: 'string', enableQuery: enableQuery, public: true}
@add 'Accounts_OAuth_Gitlab_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Gitlab_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Gitlab_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/gitlab', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Gitlab_callback_url', '_oauth/gitlab', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
......@@ -73,7 +73,10 @@ RocketChat.settings.add = (_id, value, options = {}) ->
createdAt: new Date
if not options.value?
updateOperations.$setOnInsert.value = value
if options.force is true
updateOperations.$set.value = options.packageValue
else
updateOperations.$setOnInsert.value = value
if not options.section?
updateOperations.$unset = { section: 1 }
......
......@@ -34,40 +34,46 @@ RocketChat.settings.addGroup 'Accounts', ->
RocketChat.settings.addGroup 'OAuth', ->
@section 'Facebook', ->
enableQuery = { _id: 'Accounts_OAuth_Facebook', value: true }
@add 'Accounts_OAuth_Facebook', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Facebook_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Facebook', value: true} }
@add 'Accounts_OAuth_Facebook_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Facebook', value: true} }
@add 'Accounts_OAuth_Facebook_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/facebook', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Facebook_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Facebook_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Facebook_callback_url', '_oauth/facebook', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
@section 'Google', ->
enableQuery = { _id: 'Accounts_OAuth_Google', value: true }
@add 'Accounts_OAuth_Google', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Google_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Google', value: true} }
@add 'Accounts_OAuth_Google_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Google', value: true} }
@add 'Accounts_OAuth_Google_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/google', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Google_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Google_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Google_callback_url', '_oauth/google', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
@section 'GitHub', ->
enableQuery = { _id: 'Accounts_OAuth_Github', value: true }
@add 'Accounts_OAuth_Github', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Github_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Github', value: true} }
@add 'Accounts_OAuth_Github_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Github', value: true} }
@add 'Accounts_OAuth_Github_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/github', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Github_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Github_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Github_callback_url', '_oauth/github', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
@section 'Linkedin', ->
enableQuery = { _id: 'Accounts_OAuth_Linkedin', value: true }
@add 'Accounts_OAuth_Linkedin', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Linkedin_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Linkedin', value: true} }
@add 'Accounts_OAuth_Linkedin_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Linkedin', value: true} }
@add 'Accounts_OAuth_Linkedin_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/linkedin', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Linkedin_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Linkedin_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Linkedin_callback_url', '_oauth/linkedin', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
@section 'Meteor', ->
enableQuery = { _id: 'Accounts_OAuth_Meteor', value: true }
@add 'Accounts_OAuth_Meteor', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Meteor_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Meteor', value: true} }
@add 'Accounts_OAuth_Meteor_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Meteor', value: true} }
@add 'Accounts_OAuth_Meteor_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/meteor', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Meteor_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Meteor_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Meteor_callback_url', '_oauth/meteor', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
@section 'Twitter', ->
enableQuery = { _id: 'Accounts_OAuth_Twitter', value: true }
@add 'Accounts_OAuth_Twitter', false, { type: 'boolean', public: true }
@add 'Accounts_OAuth_Twitter_id', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Twitter', value: true} }
@add 'Accounts_OAuth_Twitter_secret', '', { type: 'string', enableQuery: {_id: 'Accounts_OAuth_Twitter', value: true} }
@add 'Accounts_OAuth_Twitter_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/twitter', { type: 'string', blocked: true }
@add 'Accounts_OAuth_Twitter_id', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Twitter_secret', '', { type: 'string', enableQuery: enableQuery }
@add 'Accounts_OAuth_Twitter_callback_url', '_oauth/twitter', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
RocketChat.settings.addGroup 'General', ->
......
......@@ -32,6 +32,7 @@ Template.admin.helpers
group = FlowRouter.getParam('group')
group ?= TempSettings.findOne({ type: 'group' })?._id
return TempSettings.findOne { _id: group, type: 'group' }
sections: ->
group = FlowRouter.getParam('group')
group ?= TempSettings.findOne({ type: 'group' })?._id
......@@ -72,6 +73,10 @@ Template.admin.helpers
return if found is enableQuery.length then {} else {disabled: 'disabled'}
isReadonly: ->
if @readonly is true
return { readonly: 'readonly' }
hasChanges: (section) ->
group = FlowRouter.getParam('group')
......@@ -98,21 +103,30 @@ Template.admin.helpers
flexOpened: ->
return 'opened' if RocketChat.TabBar.isFlexOpen()
arrowPosition: ->
console.log 'room.helpers arrowPosition' if window.rocketDebug
return 'left' unless RocketChat.TabBar.isFlexOpen()
label: ->
label = @i18nLabel or @_id
return TAPi18n.__ label if label
description: ->
description = TAPi18n.__ @i18nDescription if @i18nDescription
if description? and description isnt @i18nDescription
return description
sectionIsCustomOAuth: (section) ->
return /^Custom OAuth:\s.+/.test section
callbackURL: (section) ->
id = s.strRight(section, 'Custom OAuth: ').toLowerCase()
return Meteor.absoluteUrl('_oauth/' + id)
relativeUrl: (url) ->
return Meteor.absoluteUrl(url)
selectedOption: (_id, val) ->
return RocketChat.settings.get(_id) is val
......
......@@ -53,6 +53,10 @@
{{/if}}
{{/if}}
{{#if $eq type 'relativeUrl'}}
<input class="input-monitor" type="text" name="{{_id}}" value="{{relativeUrl value}}" placeholder="{{placeholder}}" {{isDisabled}} {{isReadonly}}/>
{{/if}}
{{#if $eq type 'password'}}
<input class="input-monitor" type="password" name="{{_id}}" value="{{value}}" placeholder="{{placeholder}}" {{isDisabled}}/>
{{/if}}
......
......@@ -5,5 +5,5 @@ RocketChat.settings.addGroup 'OAuth', ->
@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 }
@add 'Accounts_OAuth_Wordpress_callback_url', '_oauth/wordpress', { type: 'relativeUrl', readonly: true, force: true, enableQuery: enableQuery }
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