diff --git a/messages/en-US.json b/messages/en-US.json index 8b04e4ea..db649cdd 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1135,7 +1135,7 @@ "create": "Create", "orgs": "Organizations", "loginError": "An error occurred while logging in", - "loginRequiredForDevice": "Login is required to authenticate your device.", + "loginRequiredForDevice": "Login is required for your device.", "passwordForgot": "Forgot your password?", "otpAuth": "Two-Factor Authentication", "otpAuthDescription": "Enter the code from your authenticator app or one of your single-use backup codes.", @@ -1876,7 +1876,7 @@ "orgAuthChooseIdpDescription": "Choose your identity provider to continue", "orgAuthNoIdpConfigured": "This organization doesn't have any identity providers configured. You can log in with your Pangolin identity instead.", "orgAuthSignInWithPangolin": "Sign in with Pangolin", - "orgAuthSignInToOrg": "Sign in to an organization", + "orgAuthSignInToOrg": "Use organization's identity provider", "orgAuthSelectOrgTitle": "Organization Sign In", "orgAuthSelectOrgDescription": "Enter your organization ID to continue", "orgAuthOrgIdPlaceholder": "your-organization", diff --git a/server/routers/auth/index.ts b/server/routers/auth/index.ts index 22040614..4600a4cc 100644 --- a/server/routers/auth/index.ts +++ b/server/routers/auth/index.ts @@ -16,4 +16,4 @@ export * from "./checkResourceSession"; export * from "./securityKey"; export * from "./startDeviceWebAuth"; export * from "./verifyDeviceWebAuth"; -export * from "./pollDeviceWebAuth"; +export * from "./pollDeviceWebAuth"; \ No newline at end of file diff --git a/src/app/auth/layout.tsx b/src/app/auth/layout.tsx index 6a72006b..fae271f5 100644 --- a/src/app/auth/layout.tsx +++ b/src/app/auth/layout.tsx @@ -44,7 +44,7 @@ export default async function AuthLayout({ children }: AuthLayoutProps) { return (
-
+
@@ -127,26 +127,6 @@ export default async function AuthLayout({ children }: AuthLayoutProps) { )} - - - {t("docs")} - - - - {t("github")} -
)} diff --git a/src/app/auth/login/page.tsx b/src/app/auth/login/page.tsx index fb327af5..0c9faafc 100644 --- a/src/app/auth/login/page.tsx +++ b/src/app/auth/login/page.tsx @@ -103,6 +103,10 @@ export default async function Page(props: { redirect={redirectUrl} idps={loginIdps} forceLogin={forceLogin} + showOrgLogin={ + !isInvite && (build === "saas" || env.flags.useOrgOnlyIdp) + } + searchParams={searchParams} /> {(!signUpDisabled || isInvite) && ( @@ -120,35 +124,6 @@ export default async function Page(props: {

)} - - {!isInvite && (build === "saas" || env.flags.useOrgOnlyIdp) ? ( -
- {t("needToSignInToOrg")} - - {t("orgAuthSignInToOrg")} - -
- ) : null} ); } - -function buildQueryString(searchParams: { - [key: string]: string | string[] | undefined; -}): string { - const params = new URLSearchParams(); - const redirect = searchParams.redirect; - const forceLogin = searchParams.forceLogin; - - if (redirect && typeof redirect === "string") { - params.set("redirect", redirect); - } - if (forceLogin && typeof forceLogin === "string") { - params.set("forceLogin", forceLogin); - } - const queryString = params.toString(); - return queryString ? `?${queryString}` : ""; -} diff --git a/src/components/DashboardLoginForm.tsx b/src/components/DashboardLoginForm.tsx index ccb5c497..5082f00d 100644 --- a/src/components/DashboardLoginForm.tsx +++ b/src/components/DashboardLoginForm.tsx @@ -17,17 +17,26 @@ import { cleanRedirect } from "@app/lib/cleanRedirect"; import BrandingLogo from "@app/components/BrandingLogo"; import { useTranslations } from "next-intl"; import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext"; +import Link from "next/link"; +import { Button } from "./ui/button"; +import { ArrowRight } from "lucide-react"; type DashboardLoginFormProps = { redirect?: string; idps?: LoginFormIDP[]; forceLogin?: boolean; + showOrgLogin?: boolean; + searchParams?: { + [key: string]: string | string[] | undefined; + }; }; export default function DashboardLoginForm({ redirect, idps, - forceLogin + forceLogin, + showOrgLogin, + searchParams }: DashboardLoginFormProps) { const router = useRouter(); const { env } = useEnvContext(); @@ -35,6 +44,9 @@ export default function DashboardLoginForm({ const { isUnlocked } = useLicenseStatusContext(); function getSubtitle() { + if (forceLogin) { + return t("loginRequiredForDevice"); + } if (isUnlocked() && env.branding?.loginPage?.subtitleText) { return env.branding.loginPage.subtitleText; } @@ -57,6 +69,22 @@ export default function DashboardLoginForm({

{getSubtitle()}

+ {showOrgLogin && ( +
+ + + +
+ )} ); } + +function buildQueryString(searchParams: { + [key: string]: string | string[] | undefined; +}): string { + const params = new URLSearchParams(); + const redirect = searchParams.redirect; + const forceLogin = searchParams.forceLogin; + + if (redirect && typeof redirect === "string") { + params.set("redirect", redirect); + } + if (forceLogin && typeof forceLogin === "string") { + params.set("forceLogin", forceLogin); + } + const queryString = params.toString(); + return queryString ? `?${queryString}` : ""; +} diff --git a/src/components/LoginForm.tsx b/src/components/LoginForm.tsx index ce1f4dcb..49bcc69b 100644 --- a/src/components/LoginForm.tsx +++ b/src/components/LoginForm.tsx @@ -409,15 +409,6 @@ export default function LoginForm({ return (
- {forceLogin && ( - - - - {t("loginRequiredForDevice")} - - - )} - {showSecurityKeyPrompt && (