mirror of
https://0xacab.org/sutty/sutty
synced 2025-01-19 11:13:38 +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
|
render html: body(:gave_consent), status: status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def site_id
|
||||||
|
params[:site_id].gsub(/\.#{Site.domain}\z/, '')
|
||||||
|
end
|
||||||
|
|
||||||
# Encuentra el sitio
|
# Encuentra el sitio
|
||||||
def site
|
def site
|
||||||
@site ||= Site.find_by(name: params[:site_id])
|
@site ||= Site.find_by(name: site_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parámetros limpios
|
# Parámetros limpios
|
||||||
|
|
|
@ -65,11 +65,15 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'enviar un mensaje genera correos' do
|
test 'enviar un mensaje genera correos' do
|
||||||
|
ActionMailer::Base.deliveries.clear
|
||||||
|
|
||||||
|
redirect = "#{@site.url}/?thanks"
|
||||||
|
|
||||||
10.times do
|
10.times do
|
||||||
create :rol, site: @site
|
create :rol, site: @site
|
||||||
end
|
end
|
||||||
|
|
||||||
post v1_site_contact_url(@site),
|
post v1_site_contact_url(site_id: @site.hostname),
|
||||||
headers: {
|
headers: {
|
||||||
Origin: @site.url
|
Origin: @site.url
|
||||||
},
|
},
|
||||||
|
@ -79,9 +83,11 @@ module Api
|
||||||
contact: SecureRandom.hex,
|
contact: SecureRandom.hex,
|
||||||
from: "#{SecureRandom.hex}@sutty.nl",
|
from: "#{SecureRandom.hex}@sutty.nl",
|
||||||
body: SecureRandom.hex,
|
body: SecureRandom.hex,
|
||||||
gdpr: true
|
gdpr: true,
|
||||||
|
redirect: redirect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_equal redirect, response.headers['Location']
|
||||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue