From fa4b81c56f22f12103ada2ce84894fd29ed56327 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 25 Nov 2021 10:02:30 +0000 Subject: [PATCH] reinstated basic auth --- .env.local | 2 +- pages/_document.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.env.local b/.env.local index bd36a918..5fdd8ec5 100644 --- a/.env.local +++ b/.env.local @@ -46,7 +46,7 @@ RELAYPATH = "test-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 SHOWLOGIN = "true" SHOWREPRESENTATIONS = "false" -//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 +BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 PORT= "3000" diff --git a/pages/_document.js b/pages/_document.js index 1484617a..ee61194d 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -9,18 +9,18 @@ class MyDocument extends Document { let useGATracking = false; - // remove this block when not need after softlaunch - // let hasBasicAuth = - // typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined"; + //remove this block when not need after softlaunch + let hasBasicAuth = + typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined"; - // console.log(hasBasicAuth); + console.log(hasBasicAuth); - // if (ctx.req && ctx.res) { - // hasBasicAuth && - // (await basicAuthMiddleware(ctx.req, ctx.res, { - // users: process.env.BASIC_AUTH_CREDENTIALS, - // })); - // } + 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"