mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 06:41:42 +00:00
usar el nombre del sitio y no el hostname
This commit is contained in:
parent
abae3b5141
commit
eb2bdacd5c
2 changed files with 13 additions and 3 deletions
|
@ -64,9 +64,13 @@ module Api
|
|||
render html: body(:gave_consent), status: status
|
||||
end
|
||||
|
||||
def site_id
|
||||
params[:site_id].gsub(/\.#{Site.domain}\z/, '')
|
||||
end
|
||||
|
||||
# Encuentra el sitio
|
||||
def site
|
||||
@site ||= Site.find_by(name: params[:site_id])
|
||||
@site ||= Site.find_by(name: site_id)
|
||||
end
|
||||
|
||||
# Parámetros limpios
|
||||
|
|
|
@ -65,11 +65,15 @@ module Api
|
|||
end
|
||||
|
||||
test 'enviar un mensaje genera correos' do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
redirect = "#{@site.url}/?thanks"
|
||||
|
||||
10.times do
|
||||
create :rol, site: @site
|
||||
end
|
||||
|
||||
post v1_site_contact_url(@site),
|
||||
post v1_site_contact_url(site_id: @site.hostname),
|
||||
headers: {
|
||||
Origin: @site.url
|
||||
},
|
||||
|
@ -79,9 +83,11 @@ module Api
|
|||
contact: SecureRandom.hex,
|
||||
from: "#{SecureRandom.hex}@sutty.nl",
|
||||
body: SecureRandom.hex,
|
||||
gdpr: true
|
||||
gdpr: true,
|
||||
redirect: redirect
|
||||
}
|
||||
|
||||
assert_equal redirect, response.headers['Location']
|
||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue