Merged PR 608: added in basic auth from env variable

added in basic auth from env variable

Related work items: #6689
This commit is contained in:
Robert Bond
2021-11-12 12:16:54 +00:00
6 changed files with 21 additions and 10 deletions
+1 -1
View File
@@ -33,4 +33,4 @@ I18N_DOMAIN = "cymru.local"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
SHOWLOGIN = "false"
SHOWREPRESENTATIONS = "false"
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2
@@ -35,7 +35,10 @@ const PersonalDetailsComplete = (props) => {
let contactid = props.accountDetails.loggedinUserId;
let updateBody = props.props.props.form.personalDetailsForm.values;
updateAccount(contactid, updateBody);
}, []);
}, [
props.accountDetails.loggedinUserId,
props.props.props.form.personalDetailsForm.values,
]);
return (
<>
+3 -1
View File
@@ -42,7 +42,9 @@ const CookieManagementMain = (props) => {
";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
usageState == "revoked" && delete_cookie("CookiePolicy", "/");
usageState == "revoked" && delete_cookie("CookiePolicy", "/"),
delete_cookie("_ga", "/"),
delete_cookie("_gid", "/");
cookie.set("planning_casework", true, {
expires: expDate,
+1 -1
View File
@@ -159,7 +159,7 @@ let Login = (props) => {
shallow: true,
})
: "";
}, []);
}, [cookies.pinsUser, router]);
return (
<div className="card" id="login-card">
+1
View File
@@ -56,6 +56,7 @@ let CompleteAppeal = (props) => {
props.props.form.appealForm.values,
props.appealType.appealLPA,
props.props.accountDetails.loggedinUserId,
props.appealType.appealTypeID,
]);
const getFormCollection = (formtype) => {
+11 -6
View File
@@ -9,6 +9,17 @@ class MyDocument extends Document {
let useGATracking = false;
// remove this block when not need after softlaunch
let hasBasicAuth =
typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined";
if (ctx.req && ctx.res) {
hasBasicAuth &&
(await basicAuthMiddleware(ctx.req, ctx.res, {
users: process.env.BASIC_AUTH_CREDENTIALS,
}));
}
if (ctx.req && ctx.req.headers.cookie) {
typeof ctx.req.cookies.CookiePolicy != "undefined"
? JSON.parse(ctx.req.cookies.CookiePolicy).usage == "accepted"
@@ -19,12 +30,6 @@ class MyDocument extends Document {
useGATracking = false;
}
// if (ctx.req && ctx.res) {
// await basicAuthMiddleware(ctx.req, ctx.res, {
// users: process.env.BASIC_AUTH_CREDENTIALS,
// });
// }
return { ...initialProps, useGATracking };
}