fix: resolve critical security and UI session mismatch by clearing React Query cache on login/logout and invalidating on subscription updates
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m24s

This commit is contained in:
2026-06-14 11:15:09 +02:00
parent 136d40c7d8
commit c7506e6aca
6 changed files with 28 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
'use client';
import { useState, useEffect, useCallback } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import Link from 'next/link';
import { useRouter, useSearchParams } from 'next/navigation';
import { Eye, EyeOff, Mail, Lock, ArrowRight, Loader2, Languages } from 'lucide-react';
@@ -31,6 +32,8 @@ export function LoginForm() {
const { clientId: googleClientId, enabled: googleEnabled } = useGoogleConfig();
const queryClient = useQueryClient();
useEffect(() => {
if (loginMutation.isError && loginMutation.error) {
notify({
@@ -39,7 +42,7 @@ export function LoginForm() {
variant: 'destructive',
});
}
}, [loginMutation.isError, loginMutation.error, notify]);
}, [loginMutation.isError, loginMutation.error, notify, t]);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
@@ -55,6 +58,7 @@ export function LoginForm() {
{ credential: credentialResponse.credential },
);
const { access_token, refresh_token } = response.data;
queryClient.clear();
localStorage.setItem('token', access_token);
localStorage.setItem('refresh_token', refresh_token);
router.push(redirect);
@@ -67,7 +71,7 @@ export function LoginForm() {
} finally {
setGoogleLoading(false);
}
}, [redirect, router, notify, t]);
}, [redirect, router, notify, t, queryClient]);
const handleGoogleError = useCallback(() => {
notify({