Skip to content

Commit

Permalink
allez
Browse files Browse the repository at this point in the history
  • Loading branch information
farnoux committed Feb 10, 2025
1 parent e7da556 commit dda3f65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/auth/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ export default async function LoginPage({
'use server';
const supabase = await createClientWithOldCookie();
await supabase.auth.signOut();
await supabase.auth.refreshSession();

redirect('/login');
};

const supabase = await createClientWithOldCookie();
const { data: user } = await supabase.auth.getUser();

if (user) {
if (user.user) {
await signOut();
}

Expand Down
5 changes: 4 additions & 1 deletion packages/auth/src/supabase/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export async function updateSessionOrRedirect(request: NextRequest) {

// If user is authenticated and has filled her personal data
// the only remaining allowed route is to join a collectivity
if (url.pathname.startsWith('/rejoindre-une-collectivite')) {
if (
url.pathname.startsWith('/rejoindre-une-collectivite') ||
url.pathname.startsWith('/login')
) {
return supabaseResponse;
}

Expand Down

0 comments on commit dda3f65

Please sign in to comment.