feat: email de bienvenida al registrarse + fix estilos Input
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
import { Resend } from "resend";
|
||||||
|
|
||||||
|
const resend = new Resend(process.env.RESEND_API_KEY);
|
||||||
|
|
||||||
export async function POST(req: NextRequest) {
|
export async function POST(req: NextRequest) {
|
||||||
const { email, nombre, apellido, telefono } = await req.json();
|
const { email, nombre, apellido, telefono } = await req.json();
|
||||||
@@ -14,5 +17,20 @@ export async function POST(req: NextRequest) {
|
|||||||
data: { email: email.toLowerCase().trim(), nombre, apellido, telefono },
|
data: { email: email.toLowerCase().trim(), nombre, apellido, telefono },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await resend.emails.send({
|
||||||
|
from: "Taller <noreply@taller.com>",
|
||||||
|
to: cliente.email,
|
||||||
|
subject: "¡Bienvenido al taller!",
|
||||||
|
html: `
|
||||||
|
<h2>¡Hola ${nombre}!</h2>
|
||||||
|
<p>Tu cuenta fue creada exitosamente. Ya podés pedir turnos en línea.</p>
|
||||||
|
<p>Para acceder, ingresá tu email y te mandamos un link de acceso.</p>
|
||||||
|
<a href="${process.env.MAGIC_LINK_BASE_URL}/cliente" style="background:#2563eb;color:white;padding:12px 24px;border-radius:6px;text-decoration:none;display:inline-block">
|
||||||
|
Ir al taller
|
||||||
|
</a>
|
||||||
|
<p style="color:#6b7280;font-size:14px;margin-top:16px">Si no creaste esta cuenta, ignorá este mensaje.</p>
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
return NextResponse.json({ ok: true, id: cliente.id }, { status: 201 });
|
return NextResponse.json({ ok: true, id: cliente.id }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export default function Input({ label, error, className = "", id, ...props }: In
|
|||||||
)}
|
)}
|
||||||
<input
|
<input
|
||||||
id={id}
|
id={id}
|
||||||
className={`border rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition ${
|
className={`border rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition bg-gray-100 text-gray-900 placeholder-gray-500 ${
|
||||||
error ? "border-red-400" : "border-gray-300"
|
error ? "border-red-400" : "border-gray-400"
|
||||||
} ${className}`}
|
} ${className}`}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user