fix(auth): correct login detection + return to origin after login

- isUserLoggedIn() checked the access_token cookie, which is never set
  (access_token lives in memory / tokenStore; only userInfo + uuid are
  cookies). It therefore always returned false — the claim modal (and
  comment auth checks) kept showing the login prompt even when logged in.
  Now reads the userInfo cookie.
- Claim modal login link carries ?redirect=<current path>; after OTP login
  SendReq returns to that path (guarded to internal "/..." only, blocks
  protocol-relative //) instead of always going to "/".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-11 15:12:58 +03:30
co-authored by Claude Opus 4.8
parent 4fed9a8c57
commit f584f581e5
3 changed files with 11 additions and 5 deletions
+2 -2
View File
@@ -681,8 +681,8 @@ export function timeAgo(timestamp) {
}
export function isUserLoggedIn() {
const userInfo = Cookies.get("access_token");
return !!userInfo;
// access_token در memory است نه کوکی؛ userInfo کوکیِ non-httpOnly است که هنگام لاگین ست می‌شود.
return !!Cookies.get("userInfo");
}
export function convertTimestampToPersianDateSimple(timestamp) {