From 7f6905f08b10eaf28fcc3e257bc3cf34f1a3c39d Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Tue, 3 Oct 2023 17:08:31 -0500 Subject: [PATCH] fix: Add root path to account url --- src/account/components/AccountLogin.js | 2 +- src/account/components/AccountLogin.test.js | 2 +- src/account/components/RequireAuth.js | 2 +- src/account/components/RequireAuth.test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/account/components/AccountLogin.js b/src/account/components/AccountLogin.js index bb5e6fd3aa..024628051c 100644 --- a/src/account/components/AccountLogin.js +++ b/src/account/components/AccountLogin.js @@ -46,7 +46,7 @@ const GoogleIcon = props => { const appendReferrer = (url, referrer) => { return referrer - ? `${url}&state=/account?referrerBase64=${btoa(referrer)}` + ? `${url}&state=account?referrerBase64=${btoa(referrer)}` : url; }; diff --git a/src/account/components/AccountLogin.test.js b/src/account/components/AccountLogin.test.js index 31b1c66c19..9b27bf39af 100644 --- a/src/account/components/AccountLogin.test.js +++ b/src/account/components/AccountLogin.test.js @@ -74,7 +74,7 @@ test('AccountLogin: Add referrer', async () => { ); await render(); expect(screen.getByText('Continue with Google')).toBeInTheDocument(); - const state = `/account?referrerBase64=${btoa(referrer)}`; + const state = `account?referrerBase64=${btoa(referrer)}`; expect(screen.getByText('Continue with Google')).toHaveAttribute( 'href', `google.url&state=${state}` diff --git a/src/account/components/RequireAuth.js b/src/account/components/RequireAuth.js index bcea17cd44..79427d96d8 100644 --- a/src/account/components/RequireAuth.js +++ b/src/account/components/RequireAuth.js @@ -49,7 +49,7 @@ const RequireAuth = ({ children }) => { const referrer = generateReferrerPath(location); const to = referrer - ? `/account?referrer=${encodeURIComponent(referrer)}` + ? `/account?referrer=/${encodeURIComponent(referrer)}` : '/account'; return ; }; diff --git a/src/account/components/RequireAuth.test.js b/src/account/components/RequireAuth.test.js index c4f1c9fee6..2d22685775 100644 --- a/src/account/components/RequireAuth.test.js +++ b/src/account/components/RequireAuth.test.js @@ -111,7 +111,7 @@ test('Auth: Test redirect referrer', async () => { ); expect( - screen.getByText('To: /account?referrer=groups%3Fsort%3D-name%26other%3D1') + screen.getByText('To: /account?referrer=/groups%3Fsort%3D-name%26other%3D1') ).toBeInTheDocument(); });