Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6f3342d
Intitial commit of vendor outage controller / view
Mar 2, 2023
fdbf976
First pass at interstitial outage page
Mar 3, 2023
90d6f87
Updating view and localizations
Mar 7, 2023
7474ba5
YAML linting
Mar 7, 2023
9ab090d
Skipping upload/hybrid-handoff during phone outage
Mar 7, 2023
7089b45
[WIP] Pass to verify-info/gpo on phone outage
Mar 7, 2023
ee52082
If no SP, use APP_NAME
solipet Mar 9, 2023
b697412
Correct link to status page
solipet Mar 9, 2023
13cf001
Handle with/out current SP. Update locales.
solipet Mar 9, 2023
58c598c
allow feature_idv_force_gpo_verification_enabled to force skip phone …
solipet Mar 14, 2023
e3d7310
adds feature_idv_hybrid_flow_enabled flag (default: true)
solipet Mar 14, 2023
a42e5fe
show a cancel link on gpo page if skipping phone finder
solipet Mar 14, 2023
d8b4357
renamed ial2 vendors to idv
solipet Mar 16, 2023
6ee0004
specs for feature flags
solipet Mar 16, 2023
114d3de
Updating locales to use app_name
Mar 17, 2023
bc3ed85
Refactoring predicate methods for redirecting
Mar 17, 2023
c47ef75
rename VendorStatus to OutageStatus
solipet Mar 20, 2023
b9b7977
renamed VendorOutageController to OutageController
solipet Mar 20, 2023
2afb44c
lints
solipet Mar 20, 2023
d5e4184
don't hardcode app name in translations
solipet Mar 20, 2023
3279933
make normalize_yaml
solipet Mar 20, 2023
004ea79
Updating to StatusPageComponent and fixing Exit button
Mar 21, 2023
3b7a2c0
lints
Mar 21, 2023
c2b7f73
Update app/controllers/idv/outage_controller.rb
eric-gade Mar 22, 2023
06025c0
Update app/views/idv/outage/show.html.erb
eric-gade Mar 22, 2023
170624d
review comments
solipet Mar 22, 2023
746c0e3
Adding hybrid flow availability check to FeatureManagement
Mar 23, 2023
fcc6659
renamed enable_gpo_verification? to gpo_verification_enabled?
solipet Mar 23, 2023
31b93ea
use FeatureManagement.idv_gpo_only? for control
solipet Mar 23, 2023
e3ff95b
rename OutageController to GpoOnlyWarningController
solipet Mar 23, 2023
1209f3a
more specs
solipet Mar 23, 2023
fa94f45
lints
solipet Mar 23, 2023
3cbd951
Re-show the mail only page if the user starts over
solipet Mar 23, 2023
78b730d
lints! 🤬
solipet Mar 23, 2023
e377397
remove spec on obsolete config doc_auth_ssn_controller_enabled
solipet Mar 24, 2023
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
2 changes: 1 addition & 1 deletion app/components/vendor_outage_alert_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def outages
end

def vendor_status
@vendor_status ||= VendorStatus.new
@vendor_status ||= OutageStatus.new
end
end
7 changes: 6 additions & 1 deletion app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,19 @@ def async_state_done(current_async_state)
move_applicant_to_idv_session
idv_session.mark_verify_info_step_complete!
idv_session.invalidate_steps_after_verify_info!
redirect_to idv_phone_url
redirect_to next_step_url
else
idv_session.invalidate_verify_info_step!
end

analytics.idv_doc_auth_verify_proofing_results(**form_response.to_h)
end

def next_step_url
return idv_gpo_url if OutageStatus.new.gpo_only?
idv_phone_url
end

def summarize_result_and_throttle_failures(summary_result)
if summary_result.success?
add_proofing_components
Expand Down
29 changes: 24 additions & 5 deletions app/controllers/idv/doc_auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,30 @@ def flow_session
end

def check_for_outage
if VendorStatus.new.any_ial2_vendor_outage?
session[:vendor_outage_redirect] = current_step
session[:vendor_outage_redirect_from_idv] = true
redirect_to vendor_outage_url
end
return if flow_session[:skip_vendor_outage]

return redirect_for_proofing_vendor_outage if OutageStatus.new.any_idv_vendor_outage?
return redirect_for_gpo_only if FeatureManagement.idv_gpo_only?
end

def redirect_for_proofing_vendor_outage
session[:vendor_outage_redirect] = current_step
session[:vendor_outage_redirect_from_idv] = true

redirect_to vendor_outage_url
end

def redirect_for_gpo_only
return redirect_to vendor_outage_url unless FeatureManagement.gpo_verification_enabled?

# During a phone outage, skip the hybrid handoff
# step and go straight to document upload
flow_session[:skip_upload_step] = true unless FeatureManagement.idv_allow_hybrid_flow?

session[:vendor_outage_redirect] = current_step
session[:vendor_outage_redirect_from_idv] = true

redirect_to idv_mail_only_warning_url
end
end
end
17 changes: 17 additions & 0 deletions app/controllers/idv/gpo_only_warning_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Idv
class GpoOnlyWarningController < ApplicationController
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.

👍 this is a good name

include IdvSession
include StepIndicatorConcern

before_action :confirm_two_factor_authenticated

def show
user_session['idv/doc_auth'][:skip_vendor_outage] = true
render :show, locals: { current_sp:, exit_url: }
end

def exit_url
current_sp&.return_to_sp_url || account_path
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def throttle

def redirect_to_next_step
if phone_confirmation_required?
if VendorStatus.new.all_phone_vendor_outage?
if OutageStatus.new.all_phone_vendor_outage?
redirect_to vendor_outage_path(from: :idv_phone)
else
send_phone_confirmation_otp_and_handle_result
Expand Down Expand Up @@ -182,7 +182,7 @@ def new_phone_added?

def gpo_letter_available
return @gpo_letter_available if defined?(@gpo_letter_available)
@gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
@gpo_letter_available ||= FeatureManagement.gpo_verification_enabled? &&
!Idv::GpoMail.new(current_user).mail_spammed?
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/phone_errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def track_event(type:)
# rubocop:disable Naming/MemoizedInstanceVariableName
def set_gpo_letter_available
return @gpo_letter_available if defined?(@gpo_letter_available)
@gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
@gpo_letter_available ||= FeatureManagement.gpo_verification_enabled? &&
!Idv::GpoMail.new(current_user).mail_spammed?
end
# rubocop:enable Naming/MemoizedInstanceVariableName
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sign_up/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def sp_request_id
end

def redirect_if_ial2_and_vendor_outage
return unless ial2_requested? && VendorStatus.new.any_ial2_vendor_outage?
return unless ial2_requested? && OutageStatus.new.any_idv_vendor_outage?

session[:vendor_outage_redirect] = CREATE_ACCOUNT
return redirect_to vendor_outage_url
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/phones_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create
private

def redirect_if_phone_vendor_outage
return unless VendorStatus.new.all_phone_vendor_outage?
return unless OutageStatus.new.all_phone_vendor_outage?
redirect_to vendor_outage_path(from: :users_phones)
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users/two_factor_authentication_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def non_phone_redirect
end

def phone_redirect
return unless phone_enabled? && !VendorStatus.new.any_phone_vendor_outage?
return unless phone_enabled? && !OutageStatus.new.any_phone_vendor_outage?
validate_otp_delivery_preference_and_send_code
true
end
Expand Down Expand Up @@ -145,7 +145,7 @@ def redirect_if_blank_phone
end

def redirect_to_vendor_outage_if_phone_only
return unless VendorStatus.new.all_phone_vendor_outage? &&
return unless OutageStatus.new.all_phone_vendor_outage? &&
phone_enabled? &&
!MfaPolicy.new(current_user).multiple_factors_enabled?
redirect_to vendor_outage_path(from: :two_factor_authentication)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/vendor_outage_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class VendorOutageController < ApplicationController
def show
vendor_status = VendorStatus.new(
vendor_status = OutageStatus.new(
sp: current_sp,
from: session.delete(:vendor_outage_redirect),
from_idv: session.delete(:vendor_outage_redirect_from_idv),
Expand All @@ -17,7 +17,7 @@ def from_idv_phone?
end

def gpo_letter_available?
FeatureManagement.enable_gpo_verification? &&
FeatureManagement.gpo_verification_enabled? &&
current_user &&
!Idv::GpoMail.new(current_user).mail_spammed?
end
Expand Down
4 changes: 2 additions & 2 deletions app/forms/new_phone_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def submit(params)
end

def delivery_preference_sms?
!VendorStatus.new.vendor_outage?(:sms)
!OutageStatus.new.vendor_outage?(:sms)
end

def delivery_preference_voice?
VendorStatus.new.vendor_outage?(:sms) || setup_voice_preference?
OutageStatus.new.vendor_outage?(:sms) || setup_voice_preference?
end

# @return [Telephony::PhoneNumberInfo, nil]
Expand Down
17 changes: 17 additions & 0 deletions app/presenters/idv/gpo_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@ def button
end

def fallback_back_path
return idv_verify_info_path if OutageStatus.new.any_phone_vendor_outage?
user_needs_address_otp_verification? ? idv_gpo_verify_path : idv_phone_path
end

def resend_requested?
current_user.decorate.pending_profile_requires_verification?
end

def back_or_cancel_partial
if OutageStatus.new.gpo_only?
'idv/doc_auth/cancel'
else
'idv/shared/back'
end
end

def back_or_cancel_parameters
if OutageStatus.new.gpo_only?
{ step: 'gpo' }
else
{ fallback_path: fallback_back_path }
end
end

private

def user_needs_address_otp_verification?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def mfa_configuration_count
end

def disabled?
VendorStatus.new.all_phone_vendor_outage? || user&.phone_configurations&.any?
OutageStatus.new.all_phone_vendor_outage? || user&.phone_configurations&.any?
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def info
end

def disabled?
VendorStatus.new.vendor_outage?(:sms)
OutageStatus.new.vendor_outage?(:sms)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def info
end

def disabled?
VendorStatus.new.vendor_outage?(:voice)
OutageStatus.new.vendor_outage?(:voice)
end
end
end
3 changes: 3 additions & 0 deletions app/services/idv/steps/welcome_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def self.analytics_submitted_event
end

def call
flow_session[:skip_upload_step] = true unless FeatureManagement.idv_allow_hybrid_flow?

return no_camera_redirect if params[:no_camera]

create_document_capture_session(document_capture_session_uuid_key)
cancel_previous_in_person_enrollments
end
Expand Down
22 changes: 16 additions & 6 deletions app/services/vendor_status.rb → app/services/outage_status.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class VendorStatus
class OutageStatus
include ActionView::Helpers::TranslationHelper

def initialize(from: nil, from_idv: nil, sp: nil)
Expand All @@ -7,9 +7,9 @@ def initialize(from: nil, from_idv: nil, sp: nil)
@sp = sp
end

IAL2_VENDORS = %i[acuant lexisnexis_instant_verify lexisnexis_trueid].freeze
IDV_VENDORS = %i[acuant lexisnexis_instant_verify lexisnexis_trueid].freeze
PHONE_VENDORS = %i[sms voice].freeze
ALL_VENDORS = (IAL2_VENDORS + PHONE_VENDORS).freeze
ALL_VENDORS = (IDV_VENDORS + PHONE_VENDORS).freeze

def vendor_outage?(vendor)
status = case vendor
Expand Down Expand Up @@ -37,8 +37,8 @@ def all_vendor_outage?(vendors = ALL_VENDORS)
vendors.all? { |vendor| vendor_outage?(vendor) }
end

def any_ial2_vendor_outage?
any_vendor_outage?(IAL2_VENDORS)
def any_idv_vendor_outage?
any_vendor_outage?(IDV_VENDORS)
end

def any_phone_vendor_outage?
Expand All @@ -49,6 +49,16 @@ def all_phone_vendor_outage?
all_vendor_outage?(PHONE_VENDORS)
end

def gpo_only?
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.

Should gpo_only? and allow_hybrid_flow? go in FeatureManagement, since they depend on vendor status and configuration? I have some similar code for an idv_available? method in #7970 that I put in there for that reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We renamed this class OutageStatus since the outage could be predicated on a vendor outage or a feature flag config option.

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.

Hmm, I think I preferred the separation of VendorStatus and FeatureManagement. To me it is not necessarily clear what OutageStatus is reporting on -- who is having the outage? Is it us or a vendor?

I think there's a clear separation between:

  • VendorStatus - which vendors are operational right now? Which classes (e.g. idv) of vendors are having trouble right now
  • FeatureManagement - given the larger state of the application, including configuration and vendor availability, what features are currently available to users?

Copy link
Copy Markdown
Contributor

@eric-gade eric-gade Mar 23, 2023

Choose a reason for hiding this comment

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

"Vendor" isn't really the right term either, though, because we aren't referring to vendors, but capabilities (ie, sms or voice).

As a middle ground, might I suggest we keep OutageStatus for services we use that are switched to out (phone etc) and FeatureManagement for user-facing features we want to be able to switch off, as @matthinz has suggested? In other words, let's move the gpo and hybrid screen switched to FeatureManagement but keep the rest as-is. Does that make sense?

Example:

  def self.idv_hybrid_flow_enabled?
    return false if not IdentityConfig.store.feature_idv_hybrid_flow_enabled
    return false if OutageStatus.new.any_phone_vendor_outage?
    true
  end

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.

That works for me. I also wonder about bringing the :sms and :voice vendors more in line with the other ones (by actually naming them in ruby source, similar to Idv vendors) might be better long-term, but I'm happy to punt that to another day.

IdentityConfig.store.feature_idv_force_gpo_verification_enabled ||
any_phone_vendor_outage?
end

def allow_hybrid_flow?
IdentityConfig.store.feature_idv_hybrid_flow_enabled &&
!any_phone_vendor_outage?
end

def from_idv?
from_idv
end
Expand All @@ -58,7 +68,7 @@ def from_idv?
#
# @return [String, nil] the localized message.
def outage_message
if any_ial2_vendor_outage?
if any_idv_vendor_outage?
if from_idv?
if sp
t('vendor_outage.blocked.idv.with_sp', service_provider: sp.friendly_name)
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/gpo/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
],
) %>

<%= render 'idv/shared/back', fallback_path: @presenter.fallback_back_path %>
<%= render @presenter.back_or_cancel_partial, @presenter.back_or_cancel_parameters %>
53 changes: 53 additions & 0 deletions app/views/idv/gpo_only_warning/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<%= render StepIndicatorComponent.new(
steps: step_indicator_steps,
current_step: :getting_started,
locale_scope: 'idv',
class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4',
) %>

<%= render StatusPageComponent.new(status: :warning) do |c| %>
<% c.header { t('vendor_outage.alerts.pinpoint.idv.header') } %>
<p>
<%= t('vendor_outage.alerts.pinpoint.idv.message_html', app_name: APP_NAME, sp_name: current_sp&.friendly_name || APP_NAME) %>
</p>
<span><%= t('vendor_outage.alerts.pinpoint.idv.options_prompt') %></span>
<ul class="margin-bottom-5">
<% t('vendor_outage.alerts.pinpoint.idv.options_html', status_page_url: StatusPage.base_url).each do | option | %>
<li>
<%= option %>
</li>
<% end %>
</ul>
<% c.action_button(
action: ->(**tag_options, &block) do
link_to(idv_doc_auth_step_path(step: :welcome), **tag_options, &block)
end,
big: true,
wide: true,
class: 'usa-button',
).with_content(t('doc_auth.buttons.continue')) %>
<% c.action_button(
action: ->(**tag_options, &block) do
link_to(exit_url, **tag_options, &block)
end,
big: true,
wide: true,
outline: true,
class: 'usa-button',
).with_content(t('links.exit_login', app_name: APP_NAME)) %>
<% c.troubleshooting_options do |tc| %>
<% tc.header { t('components.troubleshooting_options.default_heading') } %>
<% tc.option(
url: StatusPage.base_url,
new_tab: true,
).with_content(t('vendor_outage.get_updates_on_status_page')) %>
<% if decorated_session.sp_name %>
<% tc.option(
url: current_sp.return_to_sp_url,
new_tab: true,
).with_content(
t('idv.troubleshooting.options.get_help_at_sp', sp_name: decorated_session.sp_name),
) %>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/idv/gpo_verify/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<% end %>

<% if FeatureManagement.enable_gpo_verification? && !@mail_spammed %>
<% if FeatureManagement.gpo_verification_enabled? && !@mail_spammed %>
<%= link_to t('idv.messages.gpo.resend'), idv_gpo_path, class: 'display-block margin-bottom-2' %>
<% end %>

Expand Down
6 changes: 3 additions & 3 deletions app/views/idv/phone/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<%= f.radio_button(
:otp_delivery_preference,
:sms,
checked: !VendorStatus.new.vendor_outage?(:sms), # We want SMS to be default checked
disabled: VendorStatus.new.vendor_outage?(:sms),
checked: !OutageStatus.new.vendor_outage?(:sms), # We want SMS to be default checked
disabled: OutageStatus.new.vendor_outage?(:sms),
class: 'usa-radio__input usa-radio__input--bordered',
) %>
<%= f.label :otp_delivery_preference_sms, t('two_factor_authentication.otp_delivery_preference.sms'), class: 'usa-radio__label width-full' %>
Expand All @@ -81,7 +81,7 @@
<%= f.radio_button(
:otp_delivery_preference,
:voice,
disabled: VendorStatus.new.vendor_outage?(:voice),
disabled: OutageStatus.new.vendor_outage?(:voice),
class: 'usa-radio__input usa-radio__input--bordered',
) %>
<%= f.label :otp_delivery_preference_voice, t('two_factor_authentication.otp_delivery_preference.voice'), class: 'usa-radio__label width-full' %>
Expand Down
Loading