diff --git a/.env.development b/.env.development index e607f870..18bc552a 100644 --- a/.env.development +++ b/.env.development @@ -2,6 +2,8 @@ BYPASS_DSI=true HOSTING_DOMAIN=http://localhost:3000 HOSTING_ENVIRONMENT=local +CHECK_CHILDRENS_BARRED_LIST_GUIDANCE_URL=https://www.gov.uk/guidance/check-a-teachers-record + DFE_SIGN_IN_API_BASE_URL=https://dev-api.signin.education.gov.uk DFE_SIGN_IN_API_SECRET=override-locally DFE_SIGN_IN_API_AUDIENCE=signin.education.gov.uk diff --git a/.env.test b/.env.test index 8a9560b2..d547ded5 100644 --- a/.env.test +++ b/.env.test @@ -1,3 +1,4 @@ +CHECK_CHILDRENS_BARRED_LIST_GUIDANCE_URL=https://www.gov.uk/guidance/check-a-teachers-record DFE_SIGN_IN_API_BASE_URL=https://dev-api.signin.education.gov.uk DFE_SIGN_IN_API_SECRET=test DFE_SIGN_IN_API_AUDIENCE=signin.education.gov.uk diff --git a/Gemfile b/Gemfile index 6c98e456..6de2dfd0 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ gem "govuk_markdown" # Provide endpoint for server healthchecks gem "okcomputer" +gem "repost" # Sentry error reporting gem "sentry-rails" gem "sentry-ruby" diff --git a/Gemfile.lock b/Gemfile.lock index f1f1822c..82c3e3fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -419,6 +419,7 @@ GEM regexp_parser (2.9.2) reline (0.5.9) io-console (~> 0.5) + repost (0.4.2) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -629,6 +630,7 @@ DEPENDENCIES puma (~> 6.4) rails (~> 7.1.3) rails_semantic_logger + repost rladr rspec rspec-rails diff --git a/app/controllers/sign_in_controller.rb b/app/controllers/sign_in_controller.rb index fb22b198..aeb0c793 100644 --- a/app/controllers/sign_in_controller.rb +++ b/app/controllers/sign_in_controller.rb @@ -7,6 +7,11 @@ class SignInController < ApplicationController before_action :handle_failed_sign_in, if: -> { params[:oauth_failure] == "true" } def new + if DfESignIn.bypass? + redirect_post "/auth/developer/callback", options: { authenticity_token: :auto } + else + redirect_post "/auth/dfe", options: { authenticity_token: :auto } + end end private diff --git a/app/controllers/sign_out_controller.rb b/app/controllers/sign_out_controller.rb index 129c8437..57885e0e 100644 --- a/app/controllers/sign_out_controller.rb +++ b/app/controllers/sign_out_controller.rb @@ -5,6 +5,7 @@ class SignOutController < ApplicationController before_action :reset_session def new - redirect_to sign_in_path + redirect_to ENV.fetch("CHECK_RECORDS_GUIDANCE_URL", "https://www.gov.uk/guidance/check-a-teachers-record"), + allow_other_host: true end end diff --git a/spec/support/system/authentication_steps.rb b/spec/support/system/authentication_steps.rb index 96024e34..22be82e7 100644 --- a/spec/support/system/authentication_steps.rb +++ b/spec/support/system/authentication_steps.rb @@ -2,6 +2,7 @@ module AuthenticationSteps def when_i_sign_in_via_dsi(authorised: true, orgs: [organisation], accept_terms_and_conditions: true) given_dsi_auth_is_mocked(authorised:, orgs:) when_i_visit_the_sign_in_page + and_wait_for_the_page_to_load and_click_the_dsi_sign_in_button and_i_accept_the_terms_and_conditions(accept_terms_and_conditions) end @@ -10,6 +11,7 @@ def when_i_sign_in_via_dsi(authorised: true, orgs: [organisation], accept_terms_ def when_i_sign_in_as_an_internal_user_via_dsi given_dsi_auth_is_mocked(authorised: true, internal: true) when_i_visit_the_sign_in_page + and_wait_for_the_page_to_load and_click_the_dsi_sign_in_button and_i_accept_the_terms_and_conditions(true) end @@ -96,8 +98,8 @@ def when_i_visit_the_sign_in_page visit sign_in_path end - def and_click_the_dsi_sign_in_button - click_button "Start now" + def and_wait_for_the_page_to_load + page.driver.refresh end def organisations_endpoint