fix(auth): make login footer legal links open real pages, not the login tab

The login-page footer linked to /offer, /privacy and /recurrent-payments with
target=_blank, but none of those routes existed, so opening them hit the SPA
catch-all, which redirects unauthenticated users to /login — every footer link
just opened another login tab.

- Add a public PublicLegal page that fetches the offer / privacy document from the
  existing public /cabinet/info endpoints and renders sanitized HTML (DOMPurify via
  the shared formatContent helper).
- Register public /offer and /privacy routes.
- Extract sanitizeHtml/formatContent into src/utils/legalContent.ts and reuse from
  Info.tsx (was duplicated).
- Drop the /recurrent-payments footer link: there is no recurring-payments legal
  document or endpoint in the backend, so it had no real destination. Re-add once
  such a document exists.

type-check, eslint, prettier and build all pass.
This commit is contained in:
Fringg
2026-07-09 18:14:49 +03:00
parent 8f31311112
commit 37a53e40ea
7 changed files with 185 additions and 86 deletions

View File

@@ -42,6 +42,7 @@ import TelegramRedirect from './pages/TelegramRedirect';
import DeepLinkRedirect from './pages/DeepLinkRedirect';
import VerifyEmail from './pages/VerifyEmail';
import ResetPassword from './pages/ResetPassword';
import PublicLegal from './pages/PublicLegal';
import OAuthCallback from './pages/OAuthCallback';
// Dashboard - load eagerly (default route, LCP-critical)
@@ -266,6 +267,8 @@ function App() {
<Route path="/auth/oauth/callback" element={<OAuthCallback />} />
<Route path="/verify-email" element={<VerifyEmail />} />
<Route path="/reset-password" element={<ResetPassword />} />
<Route path="/offer" element={<PublicLegal doc="offer" />} />
<Route path="/privacy" element={<PublicLegal doc="privacy" />} />
<Route
path="/merge/:mergeToken"
element={