diff --git a/app/views/govuk_template.scala.html b/app/views/govuk_template.scala.html index 1a433c8..e240624 100644 --- a/app/views/govuk_template.scala.html +++ b/app/views/govuk_template.scala.html @@ -14,7 +14,7 @@ * limitations under the License. *@ -@(title: String, user: Option[CachedData] = None, additionalJavascriptFilenames: List[String] = Nil)(mainContent: Html)(implicit request: Request[_], feedbackUrl: String) +@(title: String, user: Option[CachedData] = None, additionalJavascriptFilenames: List[String] = Nil, campaignClosed: Boolean = false)(mainContent: Html)(implicit request: Request[_], feedbackUrl: String) @import config.FrontendAppConfig @import views.html.template.userDetails @@ -97,7 +97,7 @@
- @userDetails(user) + @userDetails(user, campaignClosed)
diff --git a/app/views/index/guestwelcome.scala.html b/app/views/index/guestwelcome.scala.html index 8ac605e..68f3581 100644 --- a/app/views/index/guestwelcome.scala.html +++ b/app/views/index/guestwelcome.scala.html @@ -20,7 +20,7 @@ @import helpers.CSRFieldConstructor._ @import play.filters.csrf.CSRF -@main_template(title = "Create your account or Sign in", pageForms = Seq(signInForm), notification = notification) { +@main_template(title = "Create your account or Sign in", pageForms = Seq(signInForm), notification = notification, campaignClosed = !fasttrackConfig.newAccountsEnabled) {

Sign in

@if(fasttrackConfig.newAccountsEnabled) { diff --git a/app/views/main_template.scala.html b/app/views/main_template.scala.html index f4f2104..bfd662e 100644 --- a/app/views/main_template.scala.html +++ b/app/views/main_template.scala.html @@ -14,11 +14,11 @@ * limitations under the License. *@ -@(title: String, pageForms: Seq[Form[_]] = Nil, notification: Option[(helpers.NotificationType,String)] = None, additionalJavascriptFilenames: List[String] = Nil)(mainContent: Html)(implicit request: Request[_], flash: Flash, user: Option[CachedData], feedbackUrl: String, messages: Messages) +@(title: String, pageForms: Seq[Form[_]] = Nil, notification: Option[(helpers.NotificationType,String)] = None, additionalJavascriptFilenames: List[String] = Nil, campaignClosed: Boolean = false)(mainContent: Html)(implicit request: Request[_], flash: Flash, user: Option[CachedData], feedbackUrl: String, messages: Messages) @import views.html.template.{ errorSummary, flashMessage } -@govuk_template(title = title, user = user, additionalJavascriptFilenames = additionalJavascriptFilenames) { +@govuk_template(title = title, user = user, additionalJavascriptFilenames = additionalJavascriptFilenames, campaignClosed = campaignClosed) { @flashMessage(notification) @errorSummary(pageForms) @mainContent diff --git a/app/views/template/userDetails.scala.html b/app/views/template/userDetails.scala.html index 2968b4e..a2a748c 100644 --- a/app/views/template/userDetails.scala.html +++ b/app/views/template/userDetails.scala.html @@ -14,7 +14,7 @@ * limitations under the License. *@ -@(user: Option[CachedData])(implicit request: Request[_]) +@(user: Option[CachedData], campaignClosed: Boolean)(implicit request: Request[_]) @user.map { data =>
@@ -37,7 +37,11 @@ }.getOrElse {
- Create an account or Sign in + @if(campaignClosed) { + Sign in + } else { + Create an account or Sign in + }
} \ No newline at end of file diff --git a/repository.yaml b/repository.yaml index 026167d..dc65a8d 100644 --- a/repository.yaml +++ b/repository.yaml @@ -1 +1,6 @@ digital-service: "FSET: Fasttrack" + +leakDetectionExemptions: + - ruleId: 'ip_addresses' + filePaths: + - '/test/config/WhitelistFilterConfigSpec.scala' \ No newline at end of file diff --git a/test/config/WhitelistFilterConfigSpec.scala b/test/config/WhitelistFilterConfigSpec.scala index b880361..72ca2bc 100644 --- a/test/config/WhitelistFilterConfigSpec.scala +++ b/test/config/WhitelistFilterConfigSpec.scala @@ -25,11 +25,14 @@ import play.api.test._ class WhitelistFilterConfigSpec extends PlaySpec with OneAppPerTest { + val dummyIP1 = "11.22.33.44" + val dummyIP2 = "93.00.33.33" + override def newAppForTest(td: TestData): FakeApplication = FakeApplication( additionalConfiguration = Map( "whitelistExcludedCalls" -> Base64.getEncoder.encodeToString("/ping/ping,/healthcheck".getBytes), - "whitelist" -> Base64.getEncoder.encodeToString("11.22.33.44".getBytes) + "whitelist" -> Base64.getEncoder.encodeToString(dummyIP1.getBytes) ), withGlobal = Some(ProductionFrontendGlobal) ) @@ -40,7 +43,7 @@ class WhitelistFilterConfigSpec extends PlaySpec with OneAppPerTest { FrontendAppConfig.whitelistExcluded mustBe Seq("/ping/ping", "/healthcheck") } "the whitelist IPs are requested" in { - FrontendAppConfig.whitelist mustBe Seq("11.22.33.44") + FrontendAppConfig.whitelist mustBe Seq(dummyIP1) } } } @@ -48,14 +51,14 @@ class WhitelistFilterConfigSpec extends PlaySpec with OneAppPerTest { "ProductionFrontendGlobal" must { "let requests passing" when { "coming from an IP in the white list must work as normal" in { - val request = FakeRequest(GET, "/fset-fast-track/signin").withHeaders("True-Client-IP" -> "11.22.33.44") + val request = FakeRequest(GET, "/fset-fast-track/signin").withHeaders("True-Client-IP" -> dummyIP1) val Some(result) = route(app, request) status(result) mustBe OK } "coming from a IP NOT in the white-list and not with a white-listed path must be redirected" in { - val request = FakeRequest(GET, "/fset-fast-track/signin").withHeaders("True-Client-IP" -> "93.00.33.33") + val request = FakeRequest(GET, "/fset-fast-track/signin").withHeaders("True-Client-IP" -> dummyIP2) val Some(result) = route(app, request) status(result) mustBe SEE_OTHER @@ -63,7 +66,7 @@ class WhitelistFilterConfigSpec extends PlaySpec with OneAppPerTest { } "coming from an IP NOT in the white-list, but with a white-listed path must work as normal" in { - val request = FakeRequest(GET, "/ping/ping").withHeaders("True-Client-IP" -> "93.00.33.33") + val request = FakeRequest(GET, "/ping/ping").withHeaders("True-Client-IP" -> dummyIP2) val Some(result) = route(app, request) status(result) mustBe OK