mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-23 18:50:12 +01:00
Remove the inbound message handling to get the Rails upgrade done. Pull requests for re-implementing with ActionMailbox are welcome.
Fixes #2463.
This commit is contained in:
parent
86e36b07a6
commit
a94d4fa00b
7 changed files with 1 additions and 477 deletions
|
|
@ -1,8 +1,7 @@
|
|||
class IntegrationsController < ApplicationController
|
||||
require 'mail'
|
||||
|
||||
skip_before_action :login_required, :only => [:cloudmailin, :search_plugin]
|
||||
skip_before_action :verify_authenticity_token, only: [:cloudmailin]
|
||||
skip_before_action :login_required, :only => [:search_plugin]
|
||||
|
||||
def index
|
||||
@page_title = 'TRACKS::Integrations'
|
||||
|
|
@ -21,31 +20,8 @@ class IntegrationsController < ApplicationController
|
|||
.pack('m').gsub(/\n/, '')
|
||||
end
|
||||
|
||||
def cloudmailin
|
||||
if !verify_cloudmailin_signature
|
||||
render :body => "Message signature verification failed.", :status => 403
|
||||
return false
|
||||
end
|
||||
|
||||
if process_message(params[:message])
|
||||
render :body => 'success', :status => 200
|
||||
else
|
||||
render :body => "No user found or other error", :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_message(message)
|
||||
MessageGateway.receive(Mail.new(message))
|
||||
end
|
||||
|
||||
def verify_cloudmailin_signature
|
||||
provided = request.request_parameters.delete(:signature)
|
||||
signature = Digest::MD5.hexdigest(flatten_params(request.request_parameters).sort.map { |k, v| v }.join + SITE_CONFIG['cloudmailin'])
|
||||
return provided == signature
|
||||
end
|
||||
|
||||
def flatten_params(params, title = nil, result = {})
|
||||
params.each do |key, value|
|
||||
if value.is_a? Hash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue