#### pagaai auth #### import { NextResponse } from 'next/server'; import { prisma } from '@/lib/prisma'; import { login, logout } from '@/lib/session'; export async function POST(req: Request) { const body = await req.json(); if (body.action === 'logout') { await logout(); return NextResponse.json({ success: true }); } const { username, password } = body; const user = await prisma.user.findUnique({ where: { username } }); if (!user || user.password !== password) { return NextResponse.json({ error: 'Credenciais inválidas' }, { status: 401 }); } await login(user.id, user.role); return NextResponse.json({ success: true, role: user.role }); } #### pagaairs auth #### import { NextResponse } from 'next/server'; import { prisma } from '@/lib/prisma'; import { login, logout } from '@/lib/session'; export async function POST(req: Request) { const body = await req.json(); if (body.action === 'logout') { await logout(); return NextResponse.json({ success: true }); } const { username, password } = body; const user = await prisma.user.findUnique({ where: { username } }); if (!user || user.password !== password) { return NextResponse.json({ error: 'Credenciais inválidas' }, { status: 401 }); } await login(user.id, user.role); return NextResponse.json({ success: true, role: user.role }); } #### fotto auth #### import { NextResponse } from 'next/server'; import { prisma } from '@/lib/prisma'; import { login, logout, playerLogin, playerLogout } from '@/lib/session'; export async function POST(req: Request) { try { const body = await req.json(); if (body.action === 'logout') { await logout(); await playerLogout(); return NextResponse.json({ success: true }); } const { username, password } = body; if (!username || !password) { return NextResponse.json({ error: 'Preencha o usuário/WhatsApp e a senha' }, { status: 400 }); } const cleanInput = username.trim(); // 1. Tentar autenticar como Administrador (User) let user = await prisma.user.findFirst({ where: { OR: [ { username: cleanInput }, { whatsapp: cleanInput.replace(/\D/g, '') } ] } }); if (!user) { const allUsers = #### temploagil auth #### import { NextResponse } from 'next/server'; import { prisma } from '@/lib/prisma'; import { login, logout } from '@/lib/session'; export async function POST(req: Request) { try { const body = await req.json(); if (body.action === 'logout') { await logout(); return NextResponse.json({ success: true }); } const { username, password } = body; const user = await prisma.user.findUnique({ where: { username } }); if (!user || user.password !== password) { return NextResponse.json({ error: 'Credenciais inválidas' }, { status: 401 }); } await login(user.id, user.role); return NextResponse.json({ success: true, role: user.role }); } catch (error: any) { console.error('Erro no login:', error); return NextResponse.json({ error: error?.message || 'Erro interno no servidor de banco de dados' }, { status: 500 }); } } --- PORTS --- 3000 => 200 len=11085 3001 => 200 len=11168 3005 => 200 len=12190 3009 => 200 len=11845 --- POST AUTH SMALL --- 3000 => 500 3001 => 400 {"error":"Preencha o usuário/WhatsApp e a senha"} 3005 => 500 {"error":"\nInvalid `prisma.user.findUnique()` invocation:\n\n{\n where: {\n username: undefined,\n? id?: String,\n? AND 3009 => 500 DONE