From cb96609f54f1f59b3f9323580210b173971891c4 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 8 Oct 2024 06:55:19 +0100 Subject: [PATCH] added 127 ip to csp to check for fix to app error --- components/homepage/casesearch.js | 26 +++++++++++++++++--------- pages/_document.js | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/components/homepage/casesearch.js b/components/homepage/casesearch.js index fe5b1cb6..70607037 100644 --- a/components/homepage/casesearch.js +++ b/components/homepage/casesearch.js @@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation"; import Link from "next/link"; import { useRouter } from "next/router"; import { connect } from "react-redux"; -import { Field, reduxForm } from "redux-form"; +import { Field, reduxForm, SubmissionError } from "redux-form"; import { sendGAEvent } from "@next/third-parties/google"; const required = (errorMsg) => (value) => @@ -84,14 +84,22 @@ let CaseSearch = (props) => { // }; const onHandleSubmit = (values) => { - // spinnerState(); - router.replace({ - pathname: - router.locale == "cy" - ? "/canlyniadauchwilio" - : "/searchresults", - query: { q: values.basicSearch.trim() }, - }); + if (Object.keys(values).length === 0) { + console.log(props.error); + + throw new SubmissionError({ + basicSearch: t("home:casesearch-search-validation-required"), + _error: "required", + }); + } else { + router.push({ + pathname: + router.locale == "cy" + ? "/canlyniadauchwilio" + : "/searchresults", + query: { q: values.basicSearch }, + }); + } }; return ( diff --git a/pages/_document.js b/pages/_document.js index 23e6e7c2..4671d5c3 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -42,7 +42,7 @@ class MyDocument extends Document { csp += `form-action 'self' ` + process.env.NEXTAUTH_URL + ` ;`; csp += `object-src 'self' data:;`; csp += `default-src 'self' https://www.google-analytics.com;`; - csp += `connect-src 'self' https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`; + csp += `connect-src 'self' http://127.0.0.1 https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`; csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`; csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`; csp += `img-src 'self' 'unsafe-inline' https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;