From 9ba39e99c6ef9662310796ddc5323dec904138bc Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Mon, 30 Sep 2024 07:03:02 -0700 Subject: [PATCH] feature: add region select to login/signup and improve login layout --- .../components/signup/InitialSignupStep.tsx | 2 + frontend/src/pages/_app.tsx | 18 ++- .../components/InitialStep/InitialStep.tsx | 140 ++++++++++-------- 3 files changed, 87 insertions(+), 73 deletions(-) diff --git a/frontend/src/components/signup/InitialSignupStep.tsx b/frontend/src/components/signup/InitialSignupStep.tsx index 3a7c6db04..fd63f33f0 100644 --- a/frontend/src/components/signup/InitialSignupStep.tsx +++ b/frontend/src/components/signup/InitialSignupStep.tsx @@ -4,6 +4,7 @@ import { faGithub, faGitlab, faGoogle } from "@fortawesome/free-brands-svg-icons import { faEnvelope } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { RegionSelect } from "@app/components/navigation/RegionSelect"; import { useServerConfig } from "@app/context"; import { LoginMethod } from "@app/hooks/api/admin/types"; @@ -25,6 +26,7 @@ export default function InitialSignupStep({

{t("signup.initial-title")}

+ {shouldDisplaySignupMethod(LoginMethod.GOOGLE) && (
-
- )} - {shouldDisplayLoginMethod(LoginMethod.GITHUB) && ( -
- -
- )} - {shouldDisplayLoginMethod(LoginMethod.GITLAB) && ( -
- -
- )} + {shouldDisplayLoginMethod(LoginMethod.SAML) && ( -
+
)} +
+ {shouldDisplayLoginMethod(LoginMethod.GOOGLE) && ( + + { + const callbackPort = queryParams.get("callback_port"); + + window.open( + `/api/v1/sso/redirect/google${ + callbackPort ? `?callback_port=${callbackPort}` : "" + }` + ); + window.close(); + }} + className="h-10 w-full bg-mineshaft-600" + > + + + + )} + {shouldDisplayLoginMethod(LoginMethod.GITHUB) && ( + + { + const callbackPort = queryParams.get("callback_port"); + + window.open( + `/api/v1/sso/redirect/github${ + callbackPort ? `?callback_port=${callbackPort}` : "" + }` + ); + + window.close(); + }} + className="h-10 w-full bg-mineshaft-600" + > + + + + )} + {shouldDisplayLoginMethod(LoginMethod.GITLAB) && ( + + { + const callbackPort = queryParams.get("callback_port"); + + window.open( + `/api/v1/sso/redirect/gitlab${ + callbackPort ? `?callback_port=${callbackPort}` : "" + }` + ); + + window.close(); + }} + className="h-10 w-full bg-mineshaft-600" + > + + + + )} +
{(!config.enabledLoginMethods || (shouldDisplayLoginMethod(LoginMethod.EMAIL) && config.enabledLoginMethods.length > 1)) && (
@@ -316,7 +326,7 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }: />
)} -
+