From 73e057d10757bbaf08c4e6da09f773f23efa5ba5 Mon Sep 17 00:00:00 2001 From: darkcodex20 Date: Thu, 10 Jul 2025 01:20:33 +0600 Subject: [PATCH] fix: redirect unauthenticated users from AccountInfo page Redirects unauthenticated users from the AccountInfo page to the login page to prevent unauthorized access. Signed-off-by: darkcodex20 --- .../src/pages/AccountSetting/AccountInfo/AccountInfo.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/pages/AccountSetting/AccountInfo/AccountInfo.tsx b/frontend/src/pages/AccountSetting/AccountInfo/AccountInfo.tsx index a81e89bc..d8546567 100644 --- a/frontend/src/pages/AccountSetting/AccountInfo/AccountInfo.tsx +++ b/frontend/src/pages/AccountSetting/AccountInfo/AccountInfo.tsx @@ -22,6 +22,14 @@ const AccountSettingContent = ({ user }: { user: TUserModel }) => { const auth = useAuth(); const [isOpenModalConfirm, setIsOpenModalConfirm] = useState(false); + useEffect(() => { + if (!auth.isAuthenticated) { + setUserData(null); + resetToken(); + navigate("/login"); + } + }, [auth.isAuthenticated, navigate, resetToken]); + const hostname = useMemo(() => { let h = window.APP_SETTINGS.hostname;