cf96f84470
- pages/_app.jsx: remove SessionProvider/next-auth - pages/index.jsx: nova rota '/' redireciona para /dashboard (sem auth) - pages/landing.jsx: index.jsx renomeado e comentado como desativado (preservado) - pages/dashboard.jsx: remove useSession/signOut, bloco 'Olá/Sair', importa React p/ build - pages/apps/trendsnews e worldcup2026: remove useSession (não usado no render) - pages/signin.jsx, signup.jsx, api/auth/[...nextauth].js: preservados com comentário de desativação (sem exclusão) - next build validado com sucesso
87 lines
2.5 KiB
React
87 lines
2.5 KiB
React
// LOGIN DESATIVADO TEMPORARIAMENTE (2026-07-11)
|
|
// Arquivo PRESERVADO para reativação futura. Nada neste app o referencia
|
|
// ativamente (sem links, sem SessionProvider, sem getSession).
|
|
import { useState } from "react"
|
|
import { useRouter } from "next/router"
|
|
import { signIn } from "next-auth/react"
|
|
|
|
export default function SignIn() {
|
|
const [username, setUsername] = useState("")
|
|
const [password, setPassword] = useState("")
|
|
const [error, setError] = useState("")
|
|
const [loading, setLoading] = useState(false)
|
|
const router = useRouter()
|
|
|
|
const handleSubmit = async (e) => {
|
|
e.preventDefault()
|
|
setError("")
|
|
setLoading(true)
|
|
|
|
try {
|
|
const result = await signIn("credentials", {
|
|
username,
|
|
password,
|
|
redirect: false,
|
|
callbackUrl: "/dashboard"
|
|
})
|
|
|
|
if (result?.ok) {
|
|
router.push("/dashboard")
|
|
router.refresh()
|
|
} else {
|
|
setError(result?.error || "Erro ao entrar")
|
|
}
|
|
} catch (err) {
|
|
setError("Erro de conexão")
|
|
} finally {
|
|
setLoading(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
|
|
<div className="bg-white p-8 rounded-lg shadow-md w-96">
|
|
<h2 className="text-2xl font-bold mb-6">Entrar - 1000Apps</h2>
|
|
|
|
{error && (
|
|
<div className="bg-red-100 text-red-700 p-3 rounded mb-4">
|
|
{error}
|
|
</div>
|
|
)}
|
|
|
|
<form onSubmit={handleSubmit} className="space-y-4">
|
|
<input
|
|
type="text"
|
|
placeholder="Nome de usuário"
|
|
value={username}
|
|
onChange={(e) => setUsername(e.target.value)}
|
|
className="w-full p-2 border rounded"
|
|
required
|
|
/>
|
|
<input
|
|
type="password"
|
|
placeholder="Senha"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
className="w-full p-2 border rounded"
|
|
required
|
|
/>
|
|
<button
|
|
type="submit"
|
|
disabled={loading}
|
|
className="w-full bg-blue-600 text-white py-2 rounded-lg disabled:opacity-50"
|
|
>
|
|
{loading ? "Entrando..." : "Entrar"}
|
|
</button>
|
|
</form>
|
|
|
|
<p className="text-center mt-4 text-sm">
|
|
Não tem conta?{" "}
|
|
<a href="/signup" className="text-blue-600 hover:underline">
|
|
Cadastrar
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
)
|
|
} |