diff --git a/dpc-portal/app/components/page/utility/error_component.html.erb b/dpc-portal/app/components/page/utility/error_component.html.erb index 804019b95..7a3abc5ed 100644 --- a/dpc-portal/app/components/page/utility/error_component.html.erb +++ b/dpc-portal/app/components/page/utility/error_component.html.erb @@ -32,5 +32,9 @@ <%= render Core::Button::ButtonComponent.new(label: "Sign out of Login.gov", destination: login_dot_gov_logout_path, method: :delete) %> + <% when :login_gov_signin_cancel %> + <%= link_to 'Back to portal home', new_user_session_path, class: 'usa-button usa-button--outline', data: { turbo: false }%> + <% when :login_gov_signin_fail %> + <%= link_to 'Back to portal home', new_user_session_path, class: 'usa-button usa-button--outline', data: { turbo: false }%> <% end %> diff --git a/dpc-portal/app/components/page/utility/error_component_preview.rb b/dpc-portal/app/components/page/utility/error_component_preview.rb index 75a6d63af..98b484568 100644 --- a/dpc-portal/app/components/page/utility/error_component_preview.rb +++ b/dpc-portal/app/components/page/utility/error_component_preview.rb @@ -69,6 +69,16 @@ def no_account reason = 'no_account' render(Page::Utility::ErrorComponent.new(nil, reason)) end + + def login_gov_signin_cancel + reason = 'login_gov_signin_cancel' + render(Page::Utility::ErrorComponent.new(nil, reason)) + end + + def login_gov_signin_fail + reason = 'login_gov_signin_fail' + render(Page::Utility::ErrorComponent.new(nil, reason)) + end end end end diff --git a/dpc-portal/app/controllers/login_dot_gov_controller.rb b/dpc-portal/app/controllers/login_dot_gov_controller.rb index 56a88d20c..3a6c29ac3 100644 --- a/dpc-portal/app/controllers/login_dot_gov_controller.rb +++ b/dpc-portal/app/controllers/login_dot_gov_controller.rb @@ -29,13 +29,13 @@ def failure if invitation_flow_match handle_invitation_flow_failure(invitation_flow_match[2]) elsif params[:code] - @message = 'Something went wrong.' logger.error 'Login.gov Configuration error' + render(Page::Utility::ErrorComponent.new(nil, 'login_gov_signin_fail')) else - @message = 'You have decided not to authenticate via login.gov.' Rails.logger.info(['User cancelled login', { actionContext: LoggingConstants::ActionContext::Authentication, actionType: LoggingConstants::ActionType::UserCancelledLogin }]) + render(Page::Utility::ErrorComponent.new(nil, 'login_gov_signin_cancel')) end end diff --git a/dpc-portal/config/locales/en.yml b/dpc-portal/config/locales/en.yml index 01a4d7a6b..76fba1757 100644 --- a/dpc-portal/config/locales/en.yml +++ b/dpc-portal/config/locales/en.yml @@ -45,6 +45,10 @@ en: configuration_complete: Setup complete api_disabled: API disabled access_denied: Access denied + login_gov_signin_cancel_status: Login.gov sign-in incomplete + login_gov_signin_cancel_text: Login.gov sign-in was unsuccessful. If this was an error, try signing in again. + login_gov_signin_fail_status: Login.gov sign-in failed + login_gov_signin_fail_text: Something went wrong while trying to sign-in with Login.gov. Please try again. cd_access: no_approved_enrollment_status: This organization is not currently approved by Medicare. no_approved_enrollment_text: This organization must have an approved enrollment status with Medicare to access beneficiary claims data. diff --git a/dpc-portal/spec/system/accessibility_spec.rb b/dpc-portal/spec/system/accessibility_spec.rb index 966bd33f7..35598feb7 100644 --- a/dpc-portal/spec/system/accessibility_spec.rb +++ b/dpc-portal/spec/system/accessibility_spec.rb @@ -19,7 +19,7 @@ end it 'shows login failure' do visit '/users/auth/failure' - expect(page).to have_text('Try again') + expect(page).to have_text('sign-in was unsuccessful') expect(page).to be_axe_clean.according_to axe_standard end