fix: simplify auth without resend for now

This commit is contained in:
Manohar Gupta 2026-05-10 04:32:14 +05:30
parent a57e953be6
commit e2b9ef6df3
2 changed files with 12 additions and 29 deletions

View file

@ -2,14 +2,20 @@
import { signIn } from "next-auth/react"; import { signIn } from "next-auth/react";
import { useState } from "react"; import { useState } from "react";
import { useRouter } from "next/navigation";
export default function LoginPage() { export default function LoginPage() {
const router = useRouter();
const [status, setStatus] = useState<"idle" | "loading">("idle"); const [status, setStatus] = useState<"idle" | "loading">("idle");
// Quick demo login - in production use magic link const handleLogin = async () => {
const handleDemoLogin = async () => {
setStatus("loading"); setStatus("loading");
await signIn("email", { email: "manohar6839@gmail.com", redirect: true, callbackUrl: "/" }); // Demo: auto-login with test user
await signIn("email", {
email: "manohar6839@gmail.com",
redirect: false
});
router.push("/");
}; };
return ( return (
@ -19,16 +25,12 @@ export default function LoginPage() {
<p className="text-gray-600 mb-8">Your baby tracking companion</p> <p className="text-gray-600 mb-8">Your baby tracking companion</p>
<button <button
onClick={handleDemoLogin} onClick={handleLogin}
disabled={status === "loading"} disabled={status === "loading"}
className="w-full p-4 bg-rose-400 text-white rounded-2xl font-medium shadow-md hover:bg-rose-500 transition disabled:opacity-50" className="w-full p-4 bg-rose-400 text-white rounded-2xl font-medium shadow-md hover:bg-rose-500 transition disabled:opacity-50"
> >
{status === "loading" ? "Signing in..." : "Demo Sign In"} {status === "loading" ? "Signing in..." : "Sign In"}
</button> </button>
<p className="text-sm text-gray-400 mt-4">
(Demo mode - no email needed)
</p>
</div> </div>
</div> </div>
); );

View file

@ -1,29 +1,10 @@
import NextAuth from "next-auth"; import NextAuth from "next-auth";
import { DrizzleAdapter } from "@auth/drizzle-adapter"; import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { Resend } from "resend";
import { db } from "@/db"; import { db } from "@/db";
import { users } from "@/db/schema/auth";
import { eq } from "drizzle-orm";
const resend = new Resend(process.env.RESEND_API_KEY);
export const { handlers, auth, signIn, signOut } = NextAuth({ export const { handlers, auth, signIn, signOut } = NextAuth({
adapter: DrizzleAdapter(db), adapter: DrizzleAdapter(db),
providers: [ providers: [],
{
id: "resend",
type: "email",
name: "Email",
sendVerificationRequest: async ({ identifier, url }) => {
await resend.emails.send({
from: "Tia <tia@manohargupta.com>",
to: identifier,
subject: "Sign in to Tia",
html: `<p>Click <a href="${url}">here</a> to sign in to Tia.</p>`,
});
},
},
],
pages: { pages: {
signIn: "/login", signIn: "/login",
}, },