diff --git a/apps/web/src/components/sign-in-form.tsx b/apps/web/src/components/sign-in-form.tsx index dfca798..2c3060e 100644 --- a/apps/web/src/components/sign-in-form.tsx +++ b/apps/web/src/components/sign-in-form.tsx @@ -2,7 +2,7 @@ import { Button } from "@minmon/ui/components/button"; import { Input } from "@minmon/ui/components/input"; import { Label } from "@minmon/ui/components/label"; import { useForm } from "@tanstack/react-form"; -import { useNavigate } from "@tanstack/react-router"; +import { Link, useNavigate } from "@tanstack/react-router"; import { toast } from "sonner"; import z from "zod"; @@ -10,7 +10,7 @@ import { authClient } from "@/lib/auth-client"; import Loader from "./loader"; -export default function SignInForm({ onSwitchToSignUp }: { onSwitchToSignUp: () => void }) { +export default function SignInForm() { const navigate = useNavigate({ from: "/", }); @@ -53,8 +53,14 @@ export default function SignInForm({ onSwitchToSignUp }: { onSwitchToSignUp: () } return ( -
-

Welcome Back

+
+
+

Admin Access

+

Sign in to minmon

+

+ Use your administrator account to open the protected monitoring dashboard. +

+
{ @@ -78,7 +84,7 @@ export default function SignInForm({ onSwitchToSignUp }: { onSwitchToSignUp: () onChange={(e) => field.handleChange(e.target.value)} /> {field.state.meta.errors.map((error) => ( -

+

{error?.message}

))} @@ -101,7 +107,7 @@ export default function SignInForm({ onSwitchToSignUp }: { onSwitchToSignUp: () onChange={(e) => field.handleChange(e.target.value)} /> {field.state.meta.errors.map((error) => ( -

+

{error?.message}

))} @@ -121,14 +127,11 @@ export default function SignInForm({ onSwitchToSignUp }: { onSwitchToSignUp: ()
-
- +
+

Student demo flow uses administrator sign-in only.

+ + Return to homepage +
); diff --git a/apps/web/src/routes/login.tsx b/apps/web/src/routes/login.tsx index 5abb99c..d83628e 100644 --- a/apps/web/src/routes/login.tsx +++ b/apps/web/src/routes/login.tsx @@ -1,19 +1,10 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { useState } from "react"; - import SignInForm from "@/components/sign-in-form"; -import SignUpForm from "@/components/sign-up-form"; +import { createFileRoute } from "@tanstack/react-router"; export const Route = createFileRoute("/login")({ component: RouteComponent, }); function RouteComponent() { - const [showSignIn, setShowSignIn] = useState(false); - - return showSignIn ? ( - setShowSignIn(false)} /> - ) : ( - setShowSignIn(true)} /> - ); + return ; } diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 01529cd..9d1b584 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -6,6 +6,7 @@ import { drizzleAdapter } from "better-auth/adapters/drizzle"; export function createAuth() { const db = createDb(); + const isProduction = env.NODE_ENV === "production"; return betterAuth({ database: drizzleAdapter(db, { @@ -21,8 +22,8 @@ export function createAuth() { baseURL: env.BETTER_AUTH_URL, advanced: { defaultCookieAttributes: { - sameSite: "none", - secure: true, + sameSite: isProduction ? "none" : "lax", + secure: isProduction, httpOnly: true, }, },