Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions app/controllers/redirect/policy_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
module Redirect
class PolicyController < RedirectController
def show
redirect_to_and_log(
MarketingSite.security_and_privacy_practices_url,
tracker_method: analytics.method(:policy_redirect),
)
redirect_to_and_log(policy_url, tracker_method: analytics.method(:policy_redirect))
end

private

def policy_url
case params[:policy]
when 'privacy_act_statement'
MarketingSite.privacy_act_statement_url
else
MarketingSite.security_and_privacy_practices_url
end
end
end
end
6 changes: 5 additions & 1 deletion app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@
<p class="margin-y-1">
<%= new_tab_link_to(
t('notices.privacy.security_and_privacy_practices'),
MarketingSite.security_and_privacy_practices_url,
policy_redirect_url(
policy: :security_and_privacy_practices,
flow: :sign_in,
step: :sign_in,
),
) %>
</p>

Expand Down
7 changes: 6 additions & 1 deletion app/views/idv/agreement/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
<p class="margin-top-2">
<%= new_tab_link_to(
t('doc_auth.instructions.learn_more'),
policy_redirect_url(flow: :idv, step: :agreement, location: :consent),
policy_redirect_url(
policy: :security_and_privacy_practices,
flow: :idv,
step: :agreement,
location: :consent,
),
) %>
</p>
<div class="margin-top-4">
Expand Down
41 changes: 40 additions & 1 deletion spec/controllers/redirect/policy_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

describe '#show' do
let(:location_params) { { flow: 'flow', step: 'step', location: 'location', foo: 'bar' } }
it 'redirects to policy page' do

it 'redirects to security and privacy practices policy page' do
redirect_url = MarketingSite.security_and_privacy_practices_url

get :show, params: location_params
Expand All @@ -21,5 +22,43 @@
step: 'step',
)
end

context 'with security_and_privacy_practices policy parameter' do
let(:params) { location_params.merge(policy: :security_and_privacy_practices) }

it 'redirects to security and privacy practices policy page' do
redirect_url = MarketingSite.security_and_privacy_practices_url

get :show, params: location_params

expect(response).to redirect_to redirect_url
expect(@analytics).to have_logged_event(
'Policy Page Redirect',
flow: 'flow',
location: 'location',
redirect_url: redirect_url,
step: 'step',
)
end
end

context 'with privacy_act_statement policy parameter' do
let(:params) { location_params.merge(policy: :privacy_act_statement) }

it 'redirects to privacy act statement policy page' do
redirect_url = MarketingSite.privacy_act_statement_url

get :show, params: params

expect(response).to redirect_to redirect_url
expect(@analytics).to have_logged_event(
'Policy Page Redirect',
flow: 'flow',
location: 'location',
redirect_url: redirect_url,
step: 'step',
)
end
end
end
end
33 changes: 13 additions & 20 deletions spec/views/devise/sessions/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,19 @@
it 'includes a link to security / privacy page and privacy statement act' do
render

expect(rendered).
to have_link(
t('notices.privacy.security_and_privacy_practices'),
href: MarketingSite.security_and_privacy_practices_url,
)
expect(rendered).
to have_selector(
"a[href='#{MarketingSite.security_and_privacy_practices_url}']\
[target='_blank'][rel='noopener noreferrer']",
)

expect(rendered).
to have_link(
t('notices.privacy.privacy_act_statement'),
href: MarketingSite.privacy_act_statement_url,
)
expect(rendered).to have_selector(
"a[href='#{MarketingSite.privacy_act_statement_url}']\
[target='_blank'][rel='noopener noreferrer']",
)
expect(rendered).to have_link(
t('notices.privacy.security_and_privacy_practices'),
href: policy_redirect_url(
policy: :security_and_privacy_practices,
flow: :sign_in,
step: :sign_in,
),
) { |link| link[:target] == '_blank' && link[:rel] == 'noopener noreferrer' }

expect(rendered).to have_link(
t('notices.privacy.privacy_act_statement'),
href: MarketingSite.privacy_act_statement_url,
) { |link| link[:target] == '_blank' && link[:rel] == 'noopener noreferrer' }
end

context 'when SP is present' do
Expand Down
7 changes: 6 additions & 1 deletion spec/views/idv/agreement/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
it 'renders a link to the privacy & security page' do
expect(rendered).to have_link(
t('doc_auth.instructions.learn_more'),
href: policy_redirect_url(flow: :idv, step: :agreement, location: :consent),
href: policy_redirect_url(
policy: :security_and_privacy_practices,
flow: :idv,
step: :agreement,
location: :consent,
),
)
end
end