correction du token lors du login
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
'use client';
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import LoginClient from "@/components/LoginClient";
|
||||
|
||||
import LoginPage from '@/components/LoginPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
export default async function Login() {
|
||||
const session = await auth();
|
||||
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
if (session?.user) {
|
||||
redirect("/dashboard");
|
||||
}
|
||||
|
||||
return (
|
||||
<LoginPage
|
||||
onSuccess={() => router.push('/dashboard')}
|
||||
onRegister={() => router.push('/signup')}
|
||||
/>
|
||||
);
|
||||
return <LoginClient />;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
'use client';
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import HomeClient from "@/components/HomeClient";
|
||||
|
||||
import LandingPage from '@/components/LandingPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
export default async function Home() {
|
||||
const session = await auth();
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
if (session?.user) {
|
||||
redirect("/dashboard");
|
||||
}
|
||||
|
||||
return (
|
||||
<LandingPage
|
||||
onLogin={() => router.push('/login')}
|
||||
onFeatures={() => router.push('/features')}
|
||||
onPricing={() => router.push('/pricing')}
|
||||
/>
|
||||
);
|
||||
return <HomeClient />;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
'use client';
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import SignupClient from "@/components/SignupClient";
|
||||
|
||||
import AuthPage from '@/components/AuthPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
export default async function Signup() {
|
||||
const session = await auth();
|
||||
|
||||
export default function Signup() {
|
||||
const router = useRouter();
|
||||
if (session?.user) {
|
||||
redirect("/dashboard");
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthPage
|
||||
onBack={() => router.push('/')}
|
||||
onSuccess={() => router.push('/dashboard')}
|
||||
initialMode="signup"
|
||||
/>
|
||||
);
|
||||
return <SignupClient />;
|
||||
}
|
||||
|
||||
16
src/components/HomeClient.tsx
Normal file
16
src/components/HomeClient.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import LandingPage from '@/components/LandingPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function HomeClient() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<LandingPage
|
||||
onLogin={() => router.push('/login')}
|
||||
onFeatures={() => router.push('/features')}
|
||||
onPricing={() => router.push('/pricing')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
15
src/components/LoginClient.tsx
Normal file
15
src/components/LoginClient.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
'use client';
|
||||
|
||||
import LoginPage from '@/components/LoginPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function LoginClient() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<LoginPage
|
||||
onSuccess={() => router.push('/dashboard')}
|
||||
onRegister={() => router.push('/signup')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
16
src/components/SignupClient.tsx
Normal file
16
src/components/SignupClient.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import AuthPage from '@/components/AuthPage';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function SignupClient() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<AuthPage
|
||||
onBack={() => router.push('/')}
|
||||
onSuccess={() => router.push('/dashboard')}
|
||||
initialMode="signup"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -37,7 +37,9 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
|
||||
],
|
||||
session: {
|
||||
strategy: 'jwt',
|
||||
maxAge: 30 * 24 * 60 * 60, // 30 days
|
||||
},
|
||||
secret: process.env.AUTH_SECRET || 'fallback_secret_for_development_purposes_only',
|
||||
callbacks: {
|
||||
async jwt({ token, user }) {
|
||||
if (user) {
|
||||
|
||||
Reference in New Issue
Block a user