mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
Verify param integrity for bounces
This commit is contained in:
parent
834b2c95bc
commit
b2c5a9a5ec
1 changed files with 13 additions and 4 deletions
|
@ -1,11 +1,20 @@
|
|||
module Api
|
||||
module V1
|
||||
class BouncesController < BaseController
|
||||
before_action :authenticate
|
||||
|
||||
# POST api/v1/bounces/
|
||||
def create
|
||||
bounced_mail_address = BouncedMailAddress.record(json)
|
||||
bounced_mail_address ? render(head: :ok) : render(head: :failed)
|
||||
BouncedMailAddress.record(bounce_params)
|
||||
head(:ok)
|
||||
rescue ActionController::ParameterMissing
|
||||
head(:bad_request)
|
||||
end
|
||||
|
||||
def bounce_params
|
||||
params.require(:data).require(:bounce).require(:bouncedRecipients).each do |r|
|
||||
r.require(:emailAddress)
|
||||
end
|
||||
|
||||
params.require(:data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue