diff --git a/client/src/App.tsx b/client/src/App.tsx index c4ff039..41ec0df 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -13,6 +13,7 @@ import LivePage from "@/pages/LivePage"; import PlayerPage from "@/pages/PlayerPage"; import KuenstlerPage from "@/pages/KuenstlerPage"; import AdminPage from "@/pages/admin"; +import LoginPage from "@/pages/login"; import PrivacyPolicy from "@/pages/PrivacyPolicy"; import TermsOfService from "@/pages/TermsOfService"; import Impressum from "@/pages/Impressum"; @@ -29,6 +30,7 @@ function Router() { + diff --git a/client/src/pages/admin.tsx b/client/src/pages/admin.tsx index 032edd2..1ec03d4 100644 --- a/client/src/pages/admin.tsx +++ b/client/src/pages/admin.tsx @@ -29,7 +29,7 @@ export default function AdminPage() { // Redirect if not admin if (!authLoading && (!isAuthenticated || !isAdmin)) { - window.location.href = "/api/login"; + window.location.href = "/login"; return null; } @@ -59,7 +59,7 @@ export default function AdminPage() { + + + + + ); +} diff --git a/server/routes.ts b/server/routes.ts index da3375e..de0fa33 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -1684,28 +1684,12 @@ Sitemap: ${baseUrl}/sitemap.xml // ===== ADMIN ROUTES ===== // Auth route to get current user - app.get('/api/auth/user', isAuthenticated, async (req: any, res) => { + app.get('/api/auth/user', authenticate, async (req, res) => { try { - // Import the generateDeterministicUUID function from replitAuth - const { createHash } = await import('crypto'); - const generateDeterministicUUID = (replitId: string): string => { - const hash = createHash('sha256').update(`replit_${replitId}`).digest('hex'); - return [ - hash.substring(0, 8), - hash.substring(8, 12), - '4' + hash.substring(13, 16), - (parseInt(hash.substring(16, 17), 16) & 0x3 | 0x8).toString(16) + hash.substring(17, 20), - hash.substring(20, 32) - ].join('-'); - }; - - const userId = generateDeterministicUUID(req.user.claims.sub); - const user = await storage.getUser(userId); + const user = await storage.getUser(req.session.userId!); if (!user) { return res.status(404).json({ message: "User not found" }); } - - // Remove sensitive data const { passwordHash, ...userResponse } = user; res.json(userResponse); } catch (error) {