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 { t } = useTranslation();
|
||||
const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } =
|
||||
props;
|
||||
const {
|
||||
handleSubmit,
|
||||
pristine,
|
||||
reset,
|
||||
submitting,
|
||||
setLoggedInUserId,
|
||||
GG_CLIENT_ID,
|
||||
GG_REDIRECT_URI,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
@@ -121,9 +128,9 @@ let Login = (props) => {
|
||||
"built login url path:",
|
||||
props.govGateway.config.authorization_endpoint +
|
||||
"?response_type=code&scope=openid&client_id=" +
|
||||
process.env.NEXT_PUBLIC_GG_CLIENT_ID +
|
||||
GG_CLIENT_ID +
|
||||
"&redirect_uri=" +
|
||||
process.env.NEXT_PUBLIC_GG_REDIRECT_URI +
|
||||
GG_REDIRECT_URI +
|
||||
"&ui_locales=" +
|
||||
(router.locale == "cy" ? "cy" : "en-GB")
|
||||
);
|
||||
@@ -176,9 +183,9 @@ let Login = (props) => {
|
||||
let ggUrl =
|
||||
props.govGateway.config.authorization_endpoint +
|
||||
"?response_type=code&scope=openid&client_id=" +
|
||||
process.env.NEXT_PUBLIC_GG_CLIENT_ID +
|
||||
GG_CLIENT_ID +
|
||||
"&redirect_uri=" +
|
||||
process.env.NEXT_PUBLIC_GG_REDIRECT_URI +
|
||||
GG_REDIRECT_URI +
|
||||
"&ui_locales=" +
|
||||
(router.locale == "cy" ? "cy" : "en-GB");
|
||||
|
||||
@@ -187,6 +194,13 @@ let Login = (props) => {
|
||||
router.replace(ggUrl);
|
||||
};
|
||||
|
||||
const govGatwayForgottenLink = () => {
|
||||
let ggUrl =
|
||||
props.govGateway.config.authorization_endpoint +
|
||||
"/login/forgot-password";
|
||||
router.replace(ggUrl);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card" id="login-card">
|
||||
<div className="card-body active">
|
||||
@@ -268,11 +282,14 @@ let Login = (props) => {
|
||||
</Link>
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
<Link href="/">
|
||||
<a className="govuk-link--no-underline">
|
||||
{t("home:login-card-forgotten-label")}{" "}
|
||||
</a>
|
||||
</Link>
|
||||
<a
|
||||
onClick={() => {
|
||||
govGatwayForgottenLink();
|
||||
}}
|
||||
className="govuk-link--no-underline"
|
||||
>
|
||||
{t("home:login-card-forgotten-label")}{" "}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+11
-3
@@ -9,9 +9,10 @@ import Inspectorate from "./homepage/inspectorate";
|
||||
import CaseComment from "./homepage/casecomment";
|
||||
import Dns from "./homepage/dns";
|
||||
|
||||
export default function MainHome({ children, pages, showLogin }) {
|
||||
const MainHome = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { showLogin, GG_REDIRECT_URI, GG_CLIENT_ID } = props;
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
@@ -28,11 +29,18 @@ export default function MainHome({ children, pages, showLogin }) {
|
||||
<CaseSearch />
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
{showLogin == "true" && <Login />}
|
||||
{showLogin == "true" && (
|
||||
<Login
|
||||
GG_CLIENT_ID={GG_CLIENT_ID}
|
||||
GG_REDIRECT_URI={GG_REDIRECT_URI}
|
||||
/>
|
||||
)}
|
||||
{/* <Inspectorate /> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default MainHome;
|
||||
|
||||
@@ -141,6 +141,8 @@ const Home = (props) => {
|
||||
pages={pages}
|
||||
showLogin={showLogin}
|
||||
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,
|
||||
loggedInUserId: portalUserObj,
|
||||
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