Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions app/controllers/idv/inherited_proofing_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Idv
class InheritedProofingController < ApplicationController
include Flow::FlowStateMachine

FLOW_STATE_MACHINE_SETTINGS = {
step_url: :idv_inherited_proofing_step_url,
final_url: nil,
flow: Idv::Flows::InheritedProofingFlow,
analytics_id: nil,
}.freeze
end
end
19 changes: 19 additions & 0 deletions app/services/idv/flows/inherited_proofing_flow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Idv
module Flows
class InheritedProofingFlow < Flow::BaseFlow
STEPS = {
get_started: Idv::Steps::InheritedProofing::GetStartedStep,
}.freeze

STEP_INDICATOR_STEPS = [
{ name: :getting_started },
].freeze

ACTIONS = {}.freeze

def initialize(controller, session, name)
super(controller, STEPS, ACTIONS, session[name])
end
end
end
end
9 changes: 9 additions & 0 deletions app/services/idv/steps/inherited_proofing/get_started_step.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Idv
module Steps
module InheritedProofing
class GetStartedStep < DocAuthBaseStep
STEP_INDICATOR_STEP = :getting_started
end
end
end
end
11 changes: 11 additions & 0 deletions app/services/idv/steps/inherited_proofing_base_step.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Idv
module Steps
class InheritedProofingBaseStep < Flow::BaseStep
def initialize(flow)
super(flow, :inherited_proofing)
end

delegate :idv_session, :session, :flow_path, to: :@flow
end
end
end
38 changes: 38 additions & 0 deletions app/views/idv/inherited_proofing/get_started.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<% title t('inherited_proofing.headings.welcome') %>

<%= render JavascriptRequiredComponent.new(
header: t('idv.welcome.no_js_header'),
intro: t('idv.welcome.no_js_intro', sp_name: decorated_session.sp_name || t('inherited_proofing.info.no_sp_name')),
) do %>
<%= render PageHeadingComponent.new.with_content(t('inherited_proofing.headings.welcome')) %>
<p>
<%= t('inherited_proofing.info.welcome_html', sp_name: decorated_session.sp_name || t('inherited_proofing.info.no_sp_name')) %>
</p>
<h2><%= t('inherited_proofing.instructions.welcome') %></h2>

<%= render ProcessListComponent.new(heading_level: :h3, class: 'margin-y-3') do |c| %>
<%= c.item(heading: t('inherited_proofing.instructions.bullet1')) %>
<% end %>

<%= simple_form_for :inherited_proofing,
url: url_for,
method: 'put',
html: { autocomplete: 'off', class: 'margin-y-5 js-consent-continue-form' } do |f| %>
<%= f.button :button,
t('inherited_proofing.buttons.continue'),
type: :submit,
class: 'usa-button--big usa-button--wide' %>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using the submit helper here, which bakes in the standard conventions of a submit button:

Suggested change
<%= f.button :button,
t('inherited_proofing.buttons.continue'),
type: :submit,
class: 'usa-button--big usa-button--wide' %>
<%= f.submit t('inherited_proofing.buttons.continue') %>

<% end %>

<h3><%= t('inherited_proofing.instructions.privacy') %></h3>
<p>
<%= t(
'inherited_proofing.info.privacy_html',
app_name: APP_NAME,
link: new_window_link_to(
t('inherited_proofing.instructions.learn_more'),
MarketingSite.security_and_privacy_practices_url,
),
) %>
</p>
<% end %>
17 changes: 17 additions & 0 deletions config/locales/inherited_proofing/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
Comment thread
gangelo marked this conversation as resolved.
en:
inherited_proofing:
buttons:
continue: Continue
headings:
welcome: Get started verifying your identity
info:
no_sp_name: The agency that you are trying to access
privacy_html: '%{app_name} is a secure, government website that adheres to the highest standards in data
protection. We only use your data to verify your identity. %{link} about our privacy and security measures.'
welcome_html: '%{sp_name} needs to make sure you are you — not someone pretending to be you.'
instructions:
bullet1: A phone number on a phone plan associated with your name
learn_more: Learn more
privacy: Our privacy and security standards
welcome: 'To verify your identity, you will need:'
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@
get '/in_person/:step' => 'in_person#show', as: :in_person_step
put '/in_person/:step' => 'in_person#update'

get '/inherited_proofing' => 'inherited_proofing#index'
get '/inherited_proofing/:step' => 'inherited_proofing#show', as: :inherited_proofing_step

# deprecated routes
get '/confirmations' => 'personal_key#show'
post '/confirmations' => 'personal_key#update'
Expand Down
47 changes: 47 additions & 0 deletions spec/controllers/idv/inherited_proofing_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'rails_helper'

describe Idv::InheritedProofingController do
describe '#index' do
it 'redirects to the first step' do
get :index

expect(response).to redirect_to idv_inherited_proofing_step_url(step: :get_started)
end
end

describe '#show' do
it 'renders the correct template' do
expect(subject).to receive(:render).with(
template: 'layouts/flow_step',
locals: hash_including(
:flow_session,
flow_namespace: 'idv',
step_template: 'idv/inherited_proofing/get_started',
step_indicator: hash_including(
:steps,
current_step: :getting_started,
),
),
).and_call_original

get :show, params: { step: 'get_started' }
end

it 'redirects to the configured next step' do
mock_next_step(:some_next_step)
get :show, params: { step: 'getting_started' }

expect(response).to redirect_to idv_inherited_proofing_step_url(:some_next_step)
end

it 'redirects to the first step if a non-existent step is given' do
get :show, params: { step: 'non_existent_step' }

expect(response).to redirect_to idv_inherited_proofing_step_url(step: :get_started)
end
end

def mock_next_step(step)
allow_any_instance_of(Idv::Flows::InheritedProofingFlow).to receive(:next_step).and_return(step)
end
end
20 changes: 20 additions & 0 deletions spec/views/idv/inherited_proofing/get_started.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'rails_helper'

describe 'idv/inherited_proofing/get_started.html.erb' do
let(:flow_session) { {} }
let(:sp_name) { nil }

before do
@decorated_session = instance_double(ServiceProviderSessionDecorator)
allow(@decorated_session).to receive(:sp_name).and_return(sp_name)
allow(view).to receive(:decorated_session).and_return(@decorated_session)
allow(view).to receive(:flow_session).and_return(flow_session)
allow(view).to receive(:url_for).and_return('https://www.example.com/')
end

it 'renders the Continue button' do
render template: 'idv/inherited_proofing/get_started'

expect(rendered).to have_button(t('inherited_proofing.buttons.continue'))
end
end