From 933fd5faf07f0144122e8cc8692ebef03dbf06c4 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Tue, 25 Jun 2024 12:22:39 +0530 Subject: [PATCH 1/6] Issueid #221626 fix: Implement AuthGuard for Route Protection in React --- src/views/AppContent/AppContent.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/views/AppContent/AppContent.jsx b/src/views/AppContent/AppContent.jsx index fb9ef9a6..7cf3cf9f 100644 --- a/src/views/AppContent/AppContent.jsx +++ b/src/views/AppContent/AppContent.jsx @@ -1,14 +1,13 @@ import React, { useEffect, Fragment } from "react"; -import { Routes, Route } from "react-router-dom"; +import { Routes, Route, useNavigate } from "react-router-dom"; import CustomizedSnackbars from "../../views/Snackbar/CustomSnackbar"; -import { useSelector } from "react-redux"; const PrivateRoute = (props) => { - const { virtualId } = useSelector((state) => state.user); - // const navigate = useNavigate(); + const virtualId = localStorage.getItem('virtualId'); + const navigate = useNavigate(); useEffect(() => { if (!virtualId && props.requiresAuth) { - // navigate("/"); + navigate("/"); } }, [virtualId]); From 2fd4db1cf6bf8390f431330d9697cdd3bbf4777b Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Wed, 26 Jun 2024 11:08:04 +0530 Subject: [PATCH 2/6] Issueid #221626 fix: Implement AuthGuard for Route Protection in React --- src/routes/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/routes/index.js b/src/routes/index.js index 375ea6fc..51560936 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -54,9 +54,12 @@ const routData = [ requiresAuth: true, }, ]; - // add login route for test rig -if (process.env.REACT_APP_IS_APP_TEST_RIG === 'true') { + +const virtualId = localStorage.getItem('virtualId'); +const isLogin = process.env.REACT_APP_IS_APP_TEST_RIG_LOGIN_ENABLE === 'true'; + +if (isLogin && !virtualId) { routData.push( { id: "route-001", From f4ab19960e549e78082a9f16a6c5691252e7738d Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Wed, 26 Jun 2024 13:48:38 +0530 Subject: [PATCH 3/6] Issueid #221626 fix: Implement AuthGuard for Route Protection in React --- src/routes/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.js b/src/routes/index.js index 51560936..7891f52b 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -57,7 +57,7 @@ const routData = [ // add login route for test rig const virtualId = localStorage.getItem('virtualId'); -const isLogin = process.env.REACT_APP_IS_APP_TEST_RIG_LOGIN_ENABLE === 'true'; +const isLogin = process.env.REACT_APP_IS_IN_APP_AUTHORISATION === 'true'; if (isLogin && !virtualId) { routData.push( From 870e270e0fdf4f68b84f626e2c916c521f0d6b5b Mon Sep 17 00:00:00 2001 From: Gourav More Date: Wed, 26 Jun 2024 13:51:50 +0530 Subject: [PATCH 4/6] Update all-dev-rig.yml --- .github/workflows/all-dev-rig.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-dev-rig.yml b/.github/workflows/all-dev-rig.yml index 78ac4392..016fff42 100644 --- a/.github/workflows/all-dev-rig.yml +++ b/.github/workflows/all-dev-rig.yml @@ -3,7 +3,7 @@ name: ALL rig dev Deployment on: push: branches: - - test-rig-1.1 + - all-1.2 jobs: deploy: From 4af5ad0451d3e8cb6370d4cc2dfebae6f203b8ff Mon Sep 17 00:00:00 2001 From: Gourav More Date: Wed, 26 Jun 2024 15:24:55 +0530 Subject: [PATCH 5/6] Update all-dev-rig.yml --- .github/workflows/all-dev-rig.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-dev-rig.yml b/.github/workflows/all-dev-rig.yml index 016fff42..7bac2619 100644 --- a/.github/workflows/all-dev-rig.yml +++ b/.github/workflows/all-dev-rig.yml @@ -73,7 +73,7 @@ jobs: REACT_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }} REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} - REACT_APP_IS_APP_TEST_RIG: ${{ vars.REACT_APP_IS_APP_TEST_RIG }} + REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build From 9c8d30b3d516fbb909853c855d553738c54e2c69 Mon Sep 17 00:00:00 2001 From: Gourav More Date: Wed, 26 Jun 2024 15:29:42 +0530 Subject: [PATCH 6/6] Issue #env config updates --- .github/workflows/all-app-sandbox.yml | 2 +- .github/workflows/all-prod-rig.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all-app-sandbox.yml b/.github/workflows/all-app-sandbox.yml index 9bfbbceb..45f36483 100644 --- a/.github/workflows/all-app-sandbox.yml +++ b/.github/workflows/all-app-sandbox.yml @@ -73,7 +73,7 @@ jobs: REACT_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }} REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} - REACT_APP_IS_APP_TEST_RIG: ${{ vars.REACT_APP_IS_APP_TEST_RIG }} + REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build diff --git a/.github/workflows/all-prod-rig.yml b/.github/workflows/all-prod-rig.yml index 01b39294..d82589ea 100644 --- a/.github/workflows/all-prod-rig.yml +++ b/.github/workflows/all-prod-rig.yml @@ -73,7 +73,7 @@ jobs: REACT_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }} REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} - REACT_APP_IS_APP_TEST_RIG: ${{ vars.REACT_APP_IS_APP_TEST_RIG }} + REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build