feat: enhance login tracking and logout functionality

- Added session storage flag to track local login success, ensuring OAuth flows do not double track login events.
- Implemented tracking for logout events in both UserDropdown and AppSidebar components, resetting PostHog identity accordingly.
- Minor formatting adjustments in GoogleLoginButton and footer-new components for consistency.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-01-02 01:10:16 -08:00
parent 458c152032
commit d20aef2957
8 changed files with 84 additions and 4 deletions

View file

@ -14,7 +14,7 @@ export function GoogleLoginButton() {
trackLoginAttempt("google");
// IMPORTANT: Use the redirect-based authorize endpoint for cross-origin OAuth
// This fixes CSRF cookie issues in Firefox/Safari where cookies set via
// This fixes CSRF cookie issues in Firefox/Safari where cookies set via
// cross-origin fetch requests may not be sent on subsequent redirects.
// The authorize-redirect endpoint does a server-side redirect to Google
// and sets the CSRF cookie properly for same-site context.

View file

@ -54,6 +54,11 @@ export function LocalLoginForm() {
// Track successful login
trackLoginSuccess("local");
// Set flag so TokenHandler knows local login was already tracked
if (typeof window !== "undefined") {
sessionStorage.setItem("login_success_tracked", "true");
}
// Success toast
toast.success(t("login_success"), {
id: loadingToast,