From 2300f303a5ff435937c2b10259adc15168069312 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Thu, 20 May 2021 13:58:58 +0200 Subject: [PATCH 1/3] signinpage: Show page in case of auto pop-up Signed-off-by: Himanshu Mishra --- packages/core/src/layout/SignInPage/SignInPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/layout/SignInPage/SignInPage.tsx b/packages/core/src/layout/SignInPage/SignInPage.tsx index 6a8dcf454e..781700fa42 100644 --- a/packages/core/src/layout/SignInPage/SignInPage.tsx +++ b/packages/core/src/layout/SignInPage/SignInPage.tsx @@ -110,6 +110,7 @@ export const SingleSignInPage = ({ if (!identity && autoShowPopup) { // Unless auto is set to true, this step should not happen. // When user intentionally clicks the Sign In button, autoShowPopup is set to true + setShowLoginPage(true); identity = await authApi.getBackstageIdentity({ instantPopup: true, }); From 4860f242d3b9b348fd15cd7ac375357e19f8ab87 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Thu, 20 May 2021 14:02:17 +0200 Subject: [PATCH 2/3] signinpage: always execute login logic on component load Signed-off-by: Himanshu Mishra --- packages/core/src/layout/SignInPage/SignInPage.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/core/src/layout/SignInPage/SignInPage.tsx b/packages/core/src/layout/SignInPage/SignInPage.tsx index 781700fa42..cfe543f9ab 100644 --- a/packages/core/src/layout/SignInPage/SignInPage.tsx +++ b/packages/core/src/layout/SignInPage/SignInPage.tsx @@ -89,7 +89,7 @@ export const SingleSignInPage = ({ const [autoShowPopup, setAutoShowPopup] = useState(auto ?? false); // Defaults to true so that an initial check for existing user session is made - const [retry, setRetry] = useState<{} | boolean | undefined>(true); + const [retry, setRetry] = useState<{} | boolean | undefined>(undefined); const [error, setError] = useState(); // The SignIn component takes some time to decide whether the user is logged-in or not. @@ -139,9 +139,7 @@ export const SingleSignInPage = ({ } }; - if (retry) { - login(); - } + login(); }, [onResult, authApi, retry, autoShowPopup]); return showLoginPage ? ( From cc592248b7e4bd1e5c41dd798640b8abb4ca4e9b Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Thu, 20 May 2021 14:04:43 +0200 Subject: [PATCH 3/3] chore: Add changeset for minor followup on signinpage Signed-off-by: Himanshu Mishra --- .changeset/lazy-gorillas-remain.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lazy-gorillas-remain.md diff --git a/.changeset/lazy-gorillas-remain.md b/.changeset/lazy-gorillas-remain.md new file mode 100644 index 0000000000..f0fdb9bedf --- /dev/null +++ b/.changeset/lazy-gorillas-remain.md @@ -0,0 +1,5 @@ +--- +'@backstage/core': patch +--- + +SignInPage: Show login page while pop-up is being displayed when `auto` prop is set.