create a login page /auth

This commit is contained in:
Leon Serfaty G
2025-09-01 07:04:00 +00:00
parent 5b8eaf9cb9
commit f2f97ce9f1
6 changed files with 5 additions and 5 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -37,7 +37,7 @@ async function AdminLayout({
if (!session) { if (!session) {
// This should be handled by middleware, but as a fallback // This should be handled by middleware, but as a fallback
const { redirect } = await import("next/navigation") const { redirect } = await import("next/navigation")
redirect("/login") redirect("/auth")
} }
return ( return (
@@ -28,7 +28,7 @@ function SubmitButton() {
} }
export default function LoginPage() { export default function AuthPage() {
const [state, formAction] = useActionState(login, undefined); const [state, formAction] = useActionState(login, undefined);
return ( return (
+2 -2
View File
@@ -6,7 +6,7 @@ import db from '@/lib/db';
export const authConfig = { export const authConfig = {
pages: { pages: {
signIn: '/login', signIn: '/auth',
}, },
providers: [ providers: [
// The Credentials provider logic has been moved to src/auth.ts // The Credentials provider logic has been moved to src/auth.ts
@@ -21,7 +21,7 @@ export const authConfig = {
return isLoggedIn; return isLoggedIn;
} else if (isLoggedIn) { } else if (isLoggedIn) {
// Redirect logged-in users from the login page to the admin dashboard // Redirect logged-in users from the login page to the admin dashboard
if (nextUrl.pathname === '/login') { if (nextUrl.pathname === '/auth') {
return Response.redirect(new URL('/admin', nextUrl)); return Response.redirect(new URL('/admin', nextUrl));
} }
return true; return true;
+1 -1
View File
@@ -24,5 +24,5 @@ export async function login(
export async function logout() { export async function logout() {
await signOut({ redirectTo: '/login' }); await signOut({ redirectTo: '/auth' });
} }