From 205f3ce29515879b12d51920513762f90156048b Mon Sep 17 00:00:00 2001 From: Richard Pattinson Date: Fri, 10 Jan 2025 10:00:21 +0000 Subject: [PATCH] Redirect sign in page --- .env.development | 2 ++ .env.test | 1 + Gemfile | 1 + Gemfile.lock | 2 ++ app/controllers/sign_in_controller.rb | 5 +++++ app/controllers/sign_out_controller.rb | 3 ++- 6 files changed, 13 insertions(+), 1 deletion(-) 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