Skip to content

Commit cfc5717

Browse files
committed
feat: let existing users log in while new sign-ups are paused
Re-enable the GitHub login button with an 'Already have access?' framing and a note that new sign-ups are paused. New-user creation stays blocked server-side (databaseHooks.user.create.before), so only existing users get in.
1 parent 656ffc8 commit cfc5717

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

apps/web/src/components/layout/auth/login-page.tsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useQuery } from "@tanstack/react-query"
12
import { useNavigate } from "@tanstack/react-router"
23
import { authClient } from "@tripwire/auth/client"
34
import { useEffect } from "react"
@@ -16,6 +17,19 @@ export function LoginPage() {
1617
const navigate = useNavigate()
1718
const { data: session, isPending } = authClient.useSession()
1819

20+
const { data: loginUrl } = useQuery({
21+
queryKey: ["github-login-url"],
22+
enabled: !isPending && !session,
23+
queryFn: async () => {
24+
const { data } = await authClient.signIn.social({
25+
provider: "github",
26+
callbackURL: "/rules",
27+
disableRedirect: true,
28+
})
29+
return data?.url ?? null
30+
},
31+
})
32+
1933
useEffect(() => {
2034
if (!isPending && session) {
2135
navigate({ to: "/" })
@@ -29,18 +43,21 @@ export function LoginPage() {
2943
return (
3044
<div className="flex h-screen w-full shrink-0 flex-col items-center justify-center gap-8 bg-[#191919] px-6 antialiased [font-synthesis:none]">
3145
<TripwireLogo className="h-10 w-10 text-white" />
32-
<div className="flex flex-col items-center gap-4">
46+
<div className="flex flex-col items-center gap-3">
47+
<span className="text-[14px] text-tw-text-secondary">
48+
Already have access?
49+
</span>
3350
<Button
34-
disabled
51+
render={<a href={loginUrl ?? undefined} />}
52+
loading={!loginUrl}
3553
variant="outline"
3654
size="sm"
37-
className="border-[#CDCDCD] bg-white text-black opacity-60"
55+
className="border-[#CDCDCD] bg-white text-black hover:bg-white/90"
3856
>
3957
Log in
4058
</Button>
41-
<p className="max-w-xs text-center text-[13px] leading-relaxed text-tw-text-secondary">
42-
Sign-ups are paused for now — we're keeping things small while we
43-
rework a few things under the hood. Check back soon.
59+
<p className="max-w-xs text-center text-[12px] leading-relaxed text-tw-text-muted">
60+
New sign-ups are paused for now — check back soon.
4461
</p>
4562
</div>
4663
</div>

0 commit comments

Comments
 (0)