Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: unlimited invite links (max_uses=0) no longer blocked as fully used

Mauriceb28b483b9015
diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts
index fc42862d0..b5518efc4 100644
--- a/server/src/routes/auth.ts
+++ b/server/src/routes/auth.ts
@@ -179,7 +179,7 @@ router.post('/register', authLimiter, (req: Request, res: Response) => {
if (invite_token) {
validInvite = db.prepare('SELECT * FROM invite_tokens WHERE token = ?').get(invite_token);
if (!validInvite) return res.status(400).json({ error: 'Invalid invite link' });
- if (validInvite.used_count >= validInvite.max_uses) return res.status(410).json({ error: 'Invite link has been fully used' });
+ if (validInvite.max_uses > 0 && validInvite.used_count >= validInvite.max_uses) return res.status(410).json({ error: 'Invite link has been fully used' });
if (validInvite.expires_at && new Date(validInvite.expires_at) < new Date()) return res.status(410).json({ error: 'Invite link has expired' });
}