-
Notifications
You must be signed in to change notification settings - Fork 166
New SSN Controller behind a feature flag #7810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
962e046
7838580
2cdf5f7
328dbea
221f6ac
2999769
5c2752f
5022ed8
c319d38
89be067
dc1ae96
37edc7e
59a429b
5168368
c9ed143
cdc8b36
4d0e34d
2a91e58
69ba274
53d4fb8
0c02dd4
acf2b8f
cc94219
092a685
f0a4912
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| module Idv | ||
| module StepUtilitiesConcern | ||
| extend ActiveSupport::Concern | ||
|
|
||
| def flow_session | ||
| user_session['idv/doc_auth'] | ||
| end | ||
|
|
||
| # copied from doc_auth_controller | ||
| def flow_path | ||
| flow_session[:flow_path] | ||
| end | ||
|
|
||
| def confirm_pii_from_doc | ||
| @pii = flow_session['pii_from_doc'] # hash with indifferent access | ||
| return if @pii.present? | ||
| flow_session.delete('Idv::Steps::DocumentCaptureStep') | ||
| redirect_to idv_doc_auth_url | ||
| end | ||
|
|
||
| # Copied from capture_doc_flow.rb | ||
| # and from doc_auth_flow.rb | ||
| def acuant_sdk_ab_test_analytics_args | ||
| capture_session_uuid = flow_session[:document_capture_session_uuid] | ||
| if capture_session_uuid | ||
| { | ||
| acuant_sdk_upgrade_ab_test_bucket: | ||
| AbTests::ACUANT_SDK.bucket(capture_session_uuid), | ||
| } | ||
| else | ||
| {} | ||
| end | ||
| end | ||
|
|
||
| def irs_reproofing? | ||
| effective_user&.decorate&.reproof_for_irs?( | ||
| service_provider: current_sp, | ||
| ).present? | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| module Idv | ||
| class SsnController < ApplicationController | ||
| include IdvSession | ||
| include StepIndicatorConcern | ||
| include StepUtilitiesConcern | ||
| include Steps::ThreatMetrixStepHelper | ||
|
|
||
| before_action :render_404_if_ssn_controller_disabled | ||
| before_action :confirm_two_factor_authenticated | ||
| before_action :confirm_pii_from_doc | ||
|
|
||
| attr_accessor :error_message | ||
|
|
||
| def show | ||
| increment_step_counts | ||
|
|
||
| analytics.idv_doc_auth_redo_ssn_submitted(**analytics_arguments) if updating_ssn | ||
|
|
||
| analytics.idv_doc_auth_ssn_visited(**analytics_arguments) | ||
|
|
||
| render :show, locals: extra_view_variables | ||
| end | ||
|
|
||
| def update | ||
| @error_message = nil | ||
| form_response = form_submit | ||
|
|
||
| unless form_response.success? | ||
| @error_message = form_response.first_error_message | ||
| redirect_to idv_ssn_url | ||
| end | ||
|
|
||
| flow_session['pii_from_doc'][:ssn] = params[:doc_auth][:ssn] | ||
|
|
||
| analytics.idv_doc_auth_ssn_submitted(**analytics_arguments) | ||
|
|
||
| irs_attempts_api_tracker.idv_ssn_submitted( | ||
| ssn: params[:doc_auth][:ssn], | ||
| ) | ||
|
|
||
| idv_session.ssn_updated! | ||
|
|
||
| redirect_to idv_verify_info_url | ||
| end | ||
|
|
||
| def extra_view_variables | ||
| { | ||
| updating_ssn: updating_ssn, | ||
| success_alert_enabled: !updating_ssn, | ||
| **threatmetrix_view_variables, | ||
| } | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def render_404_if_ssn_controller_disabled | ||
| render_not_found unless IdentityConfig.store.doc_auth_ssn_controller_enabled | ||
| end | ||
|
|
||
| def analytics_arguments | ||
| { | ||
| flow_path: flow_path, | ||
| step: 'ssn', | ||
| step_count: current_flow_step_counts['Idv::Steps::SsnStep'], | ||
| analytics_id: 'Doc Auth', | ||
| irs_reproofing: irs_reproofing?, | ||
| }.merge(**acuant_sdk_ab_test_analytics_args) | ||
| end | ||
|
|
||
| def current_flow_step_counts | ||
| user_session['idv/doc_auth_flow_step_counts'] ||= {} | ||
| user_session['idv/doc_auth_flow_step_counts'].default = 0 | ||
| user_session['idv/doc_auth_flow_step_counts'] | ||
| end | ||
|
|
||
| def increment_step_counts | ||
| current_flow_step_counts['Idv::Steps::SsnStep'] += 1 | ||
| end | ||
|
|
||
| def form_submit | ||
| Idv::SsnFormatForm.new(current_user).submit(params.require(:doc_auth).permit(:ssn)) | ||
| end | ||
|
|
||
| def updating_ssn | ||
| flow_session.dig('pii_from_doc', :ssn).present? | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,24 @@ def user_phone_confirmation_session=(new_user_phone_confirmation_session) | |
| session[:user_phone_confirmation_session] = new_user_phone_confirmation_session.to_h | ||
| end | ||
|
|
||
| def ssn_updated! | ||
| # Guard against unvalidated attributes from in-person flow in review controller | ||
| session[:applicant] = nil | ||
|
|
||
| invalidate_verify_info_step! | ||
| invalidate_phone_step! | ||
| end | ||
|
Comment on lines
+139
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to me, the name was confusing here compared to what the method does, WDYT about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can change it to |
||
|
|
||
| def invalidate_verify_info_step! | ||
| session[:resolution_successful] = nil | ||
| session[:profile_confirmation] = nil | ||
| end | ||
|
|
||
| def invalidate_phone_step! | ||
| session[:vendor_phone_confirmation] = nil | ||
| session[:user_phone_confirmation] = nil | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_accessor :user_session | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| <%# | ||
| Renders a page asking the user to enter their SSN or update their SSN if they had previously entered it. | ||
|
|
||
| locals: | ||
| * success_alert_enabled: whether or not to display a "We've successfully verified your ID" success alert | ||
| * updating_ssn: true if the user is updating their SSN instead of providing it for the first time. This | ||
| will render a different page heading and different navigation buttons in the page footer | ||
| %> | ||
| <% content_for(:pre_flash_content) do %> | ||
| <%= render StepIndicatorComponent.new( | ||
| steps: Idv::Flows::DocAuthFlow::STEP_INDICATOR_STEPS, | ||
| current_step: :verify_info, | ||
| locale_scope: 'idv', | ||
| class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4', | ||
| ) %> | ||
| <% end %> | ||
|
|
||
| <% title t('titles.doc_auth.ssn') %> | ||
|
|
||
| <% if success_alert_enabled %> | ||
| <%= render AlertComponent.new( | ||
| type: :success, | ||
| class: 'margin-bottom-4', | ||
| ) do %> | ||
| <%= t('doc_auth.headings.capture_complete') %> | ||
| <% end %> | ||
| <% end %> | ||
|
|
||
| <% if updating_ssn %> | ||
| <%= render PageHeadingComponent.new.with_content(t('doc_auth.headings.ssn_update')) %> | ||
| <% else %> | ||
| <%= render PageHeadingComponent.new.with_content(t('doc_auth.headings.ssn')) %> | ||
| <% end %> | ||
|
|
||
| <p> | ||
| <%= t('doc_auth.info.ssn') %> | ||
| <%= new_window_link_to(t('doc_auth.instructions.learn_more'), MarketingSite.security_and_privacy_practices_url) %> | ||
| </p> | ||
|
|
||
| <% if FeatureManagement.proofing_device_profiling_collecting_enabled? %> | ||
| <% if threatmetrix_session_id.present? %> | ||
| <% threatmetrix_javascript_urls.each do |threatmetrix_javascript_url| %> | ||
| <%= javascript_include_tag threatmetrix_javascript_url, nonce: true %> | ||
| <% end %> | ||
| <noscript> | ||
| <%= content_tag( | ||
| :iframe, | ||
| '', | ||
| src: threatmetrix_iframe_url, | ||
| style: 'width: 100px; height: 100px; border: 0; position: absolute; top: -5000px;', | ||
| ) %> | ||
| </noscript> | ||
| <% end %> | ||
| <% end %> | ||
|
|
||
| <% if IdentityConfig.store.proofer_mock_fallback %> | ||
| <div class="usa-alert usa-alert--info margin-bottom-4" role="status"> | ||
| <div class="usa-alert__body"> | ||
| <p class="usa-alert__text"> | ||
| <%= t('doc_auth.instructions.test_ssn') %> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <%= simple_form_for( | ||
| :doc_auth, | ||
| url: idv_ssn_url, | ||
| method: :put, | ||
| html: { autocomplete: 'off' }, | ||
| ) do |f| %> | ||
| <div class="tablet:grid-col-8"> | ||
| <%= render 'shared/ssn_field', f: f %> | ||
| </div> | ||
|
|
||
| <p><%= @error_message %></p> | ||
|
|
||
| <%= f.submit class: 'display-block margin-y-5' do %> | ||
| <% if updating_ssn %> | ||
| <%= t('forms.buttons.submit.update') %> | ||
| <% else %> | ||
| <%= t('forms.buttons.continue') %> | ||
| <% end %> | ||
| <% end %> | ||
| <% end %> | ||
|
|
||
| <% if updating_ssn %> | ||
| <%= render 'idv/shared/back', action: 'cancel_update_ssn' %> | ||
| <% else %> | ||
| <%= render 'idv/doc_auth/cancel', step: 'ssn' %> | ||
| <% end %> |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -102,6 +102,16 @@ locals: | |||||||||
| toggle_label: t('forms.ssn.show'), | ||||||||||
| ) %> | ||||||||||
| </div> | ||||||||||
| <% if IdentityConfig.store.doc_auth_ssn_controller_enabled %> | ||||||||||
|
Comment on lines
104
to
+105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would indent this whole block and line it up with the
Suggested change
|
||||||||||
| <div class='grid-auto'> | ||||||||||
| <%= button_to( | ||||||||||
| idv_ssn_url, | ||||||||||
| method: :get, | ||||||||||
| class: 'usa-button usa-button--unstyled', | ||||||||||
| 'aria-label': t('idv.buttons.change_ssn_label'), | ||||||||||
| ) { t('idv.buttons.change_label') } %> | ||||||||||
| </div> | ||||||||||
| <% else %> | ||||||||||
| <div class='grid-auto'> | ||||||||||
| <%= button_to( | ||||||||||
| idv_doc_auth_step_url(step: :redo_ssn), | ||||||||||
|
|
@@ -110,6 +120,7 @@ locals: | |||||||||
| 'aria-label': t('idv.buttons.change_ssn_label'), | ||||||||||
| ) { t('idv.buttons.change_label') } %> | ||||||||||
| </div> | ||||||||||
| <% end %> | ||||||||||
| </div> | ||||||||||
| <div class="margin-top-5"> | ||||||||||
| <%= render SpinnerButtonComponent.new( | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit, I'd indent this for clarity