Skip to content

Commit

Permalink
Fixes zammad#2866 - G Suite accounts will only allow access to apps u…
Browse files Browse the repository at this point in the history
…sing OAuth. Password-based access will no longer be supported.
  • Loading branch information
thorsteneckel committed May 28, 2020
1 parent f14607e commit 5f06c8c
Show file tree
Hide file tree
Showing 33 changed files with 1,694 additions and 34 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ gem 'omniauth-twitter'
gem 'omniauth-weibo-oauth2'

# channels
gem 'gmail_xoauth'
gem 'koala'
gem 'telegramAPI'
gem 'twitter', git: 'https://github.com/sferik/twitter.git'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ GEM
retriable (~> 2.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
gmail_xoauth (0.4.2)
oauth (>= 0.3.6)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
Expand Down Expand Up @@ -600,6 +602,7 @@ DEPENDENCIES
factory_bot_rails
faker
github_changelog_generator
gmail_xoauth
guard
guard-livereload
guard-symlink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,14 @@ class App.ControllerModal extends App.Controller
@clearAlerts()
@onSubmit(e)

startLoading: =>
@$('.modal-body').addClass('hide')
@$('.modal-loader').removeClass('hide')

stopLoading: =>
@$('.modal-body').removeClass('hide')
@$('.modal-loader').addClass('hide')

class App.SessionMessage extends App.ControllerModal
showTrySupport: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ class App.ControllerTabs extends App.Controller
events:
'click .nav-tabs [data-toggle="tab"]': 'tabRemember'

constructor: ->
super
constructor: (params) ->
@originParams = params # remember params for sub-controller
super(params)

# check authentication
if @requiredPermission
Expand Down Expand Up @@ -420,7 +421,7 @@ class App.ControllerTabs extends App.Controller
params.target = tab.target
params.el = @$("##{tab.target}")
@controllerList ||= []
@controllerList.push new tab.controller(params)
@controllerList.push new tab.controller(_.extend(@originParams, params))

# check if tabs need to be show / cant' use .tab(), because tabs are note shown (only one tab exists)
if @tabs.length <= 1
Expand Down Expand Up @@ -450,7 +451,7 @@ class App.ControllerNavSidbar extends App.Controller
@bind('ui:rerender',
=>
@render(true)
@updateNavigation(true)
@updateNavigation(true, params)
)

show: (params = {}) =>
Expand All @@ -460,7 +461,7 @@ class App.ControllerNavSidbar extends App.Controller
for key, value of params
if key isnt 'el' && key isnt 'shown' && key isnt 'match'
@[key] = value
@updateNavigation()
@updateNavigation(false, params)
if @activeController && _.isFunction(@activeController.show)
@activeController.show(params)

Expand All @@ -482,7 +483,7 @@ class App.ControllerNavSidbar extends App.Controller
selectedItem: selectedItem
)

updateNavigation: (force) =>
updateNavigation: (force, params) =>
groups = @groupsSorted()
selectedItem = @selectedItem(groups)
return if !selectedItem
Expand All @@ -491,7 +492,7 @@ class App.ControllerNavSidbar extends App.Controller
@$('.sidebar li').removeClass('active')
@$(".sidebar li a[href=\"#{selectedItem.target}\"]").parent().addClass('active')

@executeController(selectedItem)
@executeController(selectedItem, params)

groupsSorted: =>

Expand Down Expand Up @@ -552,16 +553,14 @@ class App.ControllerNavSidbar extends App.Controller

selectedItem

executeController: (selectedItem) =>
executeController: (selectedItem, params) =>

if @activeController
@activeController.el.remove()
@activeController = undefined

@$('.main').append('<div>')
@activeController = new selectedItem.controller(
el: @$('.main div')
)
@activeController = new selectedItem.controller(_.extend(params, el: @$('.main div')))

setPosition: (position) =>
return if @shown
Expand Down
7 changes: 7 additions & 0 deletions app/assets/javascripts/app/controllers/_channel/email.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class App.ChannelEmailAccountOverview extends App.Controller
'click .js-emailAddressEdit': 'emailAddressEdit'
'click .js-emailAddressDelete': 'emailAddressDelete',
'click .js-editNotificationOutbound': 'editNotificationOutbound'
'click .js-migrateGoogleMail': 'migrateGoogleMail'

constructor: ->
super
Expand Down Expand Up @@ -379,6 +380,12 @@ class App.ChannelEmailAccountOverview extends App.Controller
channelDriver: @channelDriver
)

migrateGoogleMail: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@navigate "#channels/google/#{id}"


class App.ChannelEmailEdit extends App.ControllerModal
buttonClose: true
buttonCancel: true
Expand Down
Loading

0 comments on commit 5f06c8c

Please sign in to comment.