mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +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 Api
|
||||||
module V1
|
module V1
|
||||||
class BouncesController < BaseController
|
class BouncesController < BaseController
|
||||||
before_action :authenticate
|
# POST api/v1/bounces/
|
||||||
|
|
||||||
def create
|
def create
|
||||||
bounced_mail_address = BouncedMailAddress.record(json)
|
BouncedMailAddress.record(bounce_params)
|
||||||
bounced_mail_address ? render(head: :ok) : render(head: :failed)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue