Merged PR 680: replace env variable useage so dyanmic not built
replace env variable useage so dyanmic not built Related work items: #6938
This commit is contained in:
@@ -108,8 +108,15 @@ const RenderPasswordfield = ({
|
|||||||
|
|
||||||
let Login = (props) => {
|
let Login = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } =
|
const {
|
||||||
props;
|
handleSubmit,
|
||||||
|
pristine,
|
||||||
|
reset,
|
||||||
|
submitting,
|
||||||
|
setLoggedInUserId,
|
||||||
|
GG_CLIENT_ID,
|
||||||
|
GG_REDIRECT_URI,
|
||||||
|
} = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
@@ -121,9 +128,9 @@ let Login = (props) => {
|
|||||||
"built login url path:",
|
"built login url path:",
|
||||||
props.govGateway.config.authorization_endpoint +
|
props.govGateway.config.authorization_endpoint +
|
||||||
"?response_type=code&scope=openid&client_id=" +
|
"?response_type=code&scope=openid&client_id=" +
|
||||||
process.env.NEXT_PUBLIC_GG_CLIENT_ID +
|
GG_CLIENT_ID +
|
||||||
"&redirect_uri=" +
|
"&redirect_uri=" +
|
||||||
process.env.NEXT_PUBLIC_GG_REDIRECT_URI +
|
GG_REDIRECT_URI +
|
||||||
"&ui_locales=" +
|
"&ui_locales=" +
|
||||||
(router.locale == "cy" ? "cy" : "en-GB")
|
(router.locale == "cy" ? "cy" : "en-GB")
|
||||||
);
|
);
|
||||||
@@ -176,9 +183,9 @@ let Login = (props) => {
|
|||||||
let ggUrl =
|
let ggUrl =
|
||||||
props.govGateway.config.authorization_endpoint +
|
props.govGateway.config.authorization_endpoint +
|
||||||
"?response_type=code&scope=openid&client_id=" +
|
"?response_type=code&scope=openid&client_id=" +
|
||||||
process.env.NEXT_PUBLIC_GG_CLIENT_ID +
|
GG_CLIENT_ID +
|
||||||
"&redirect_uri=" +
|
"&redirect_uri=" +
|
||||||
process.env.NEXT_PUBLIC_GG_REDIRECT_URI +
|
GG_REDIRECT_URI +
|
||||||
"&ui_locales=" +
|
"&ui_locales=" +
|
||||||
(router.locale == "cy" ? "cy" : "en-GB");
|
(router.locale == "cy" ? "cy" : "en-GB");
|
||||||
|
|
||||||
@@ -187,6 +194,13 @@ let Login = (props) => {
|
|||||||
router.replace(ggUrl);
|
router.replace(ggUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const govGatwayForgottenLink = () => {
|
||||||
|
let ggUrl =
|
||||||
|
props.govGateway.config.authorization_endpoint +
|
||||||
|
"/login/forgot-password";
|
||||||
|
router.replace(ggUrl);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="login-card">
|
<div className="card" id="login-card">
|
||||||
<div className="card-body active">
|
<div className="card-body active">
|
||||||
@@ -268,11 +282,14 @@ let Login = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
<p className="govuk-body-s">
|
<p className="govuk-body-s">
|
||||||
<Link href="/">
|
<a
|
||||||
<a className="govuk-link--no-underline">
|
onClick={() => {
|
||||||
{t("home:login-card-forgotten-label")}{" "}
|
govGatwayForgottenLink();
|
||||||
</a>
|
}}
|
||||||
</Link>
|
className="govuk-link--no-underline"
|
||||||
|
>
|
||||||
|
{t("home:login-card-forgotten-label")}{" "}
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+11
-3
@@ -9,9 +9,10 @@ import Inspectorate from "./homepage/inspectorate";
|
|||||||
import CaseComment from "./homepage/casecomment";
|
import CaseComment from "./homepage/casecomment";
|
||||||
import Dns from "./homepage/dns";
|
import Dns from "./homepage/dns";
|
||||||
|
|
||||||
export default function MainHome({ children, pages, showLogin }) {
|
const MainHome = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const { showLogin, GG_REDIRECT_URI, GG_CLIENT_ID } = props;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
@@ -28,11 +29,18 @@ export default function MainHome({ children, pages, showLogin }) {
|
|||||||
<CaseSearch />
|
<CaseSearch />
|
||||||
<CaseComment />
|
<CaseComment />
|
||||||
<Dns />
|
<Dns />
|
||||||
{showLogin == "true" && <Login />}
|
{showLogin == "true" && (
|
||||||
|
<Login
|
||||||
|
GG_CLIENT_ID={GG_CLIENT_ID}
|
||||||
|
GG_REDIRECT_URI={GG_REDIRECT_URI}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* <Inspectorate /> */}
|
{/* <Inspectorate /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default MainHome;
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ const Home = (props) => {
|
|||||||
pages={pages}
|
pages={pages}
|
||||||
showLogin={showLogin}
|
showLogin={showLogin}
|
||||||
loggedInUserId={loggedInUserId}
|
loggedInUserId={loggedInUserId}
|
||||||
|
GG_REDIRECT_URI={props.GG_REDIRECT_URI}
|
||||||
|
GG_CLIENT_ID={props.GG_CLIENT_ID}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -212,6 +214,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
hasGGCode: hasLoginCode,
|
hasGGCode: hasLoginCode,
|
||||||
loggedInUserId: portalUserObj,
|
loggedInUserId: portalUserObj,
|
||||||
loggedInUserEmail: loginEmailStr,
|
loggedInUserEmail: loginEmailStr,
|
||||||
|
GG_REDIRECT_URI: process.env.GG_REDIRECT_URI,
|
||||||
|
GG_CLIENT_ID: process.env.GG_CLIENT_ID,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user