Add Syndicate Invite Token System (Secure Links)
- Added route + handler: GenerateInviteLinkHandler to create signed tokens - Added handler: JoinSyndicateWithTokenHandler to join using invite token - Integrated secure token generation via helpers.GenerateSecureToken() - Created DB model: syndicate_invite_tokens (assumed pre-existing) - Updated syndicate view template to allow managers to generate links - Flash messaging for invite success/failure - Invite links are scoped to manager role and valid for 48 hours
This commit is contained in:
@@ -209,3 +209,18 @@ CREATE TABLE IF NOT EXISTS syndicate_invites (
|
||||
FOREIGN KEY(syndicate_id) REFERENCES syndicates(id),
|
||||
FOREIGN KEY(invited_user_id) REFERENCES users(id)
|
||||
);`
|
||||
|
||||
const SchemaSyndicateInviteTokens = `
|
||||
CREATE TABLE IF NOT EXISTS syndicate_invite_tokens (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
syndicate_id INTEGER NOT NULL,
|
||||
token TEXT NOT NULL UNIQUE,
|
||||
invited_by_user_id INTEGER NOT NULL,
|
||||
accepted_by_user_id INTEGER,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
accepted_at TIMESTAMP,
|
||||
expires_at TIMESTAMP,
|
||||
FOREIGN KEY (syndicate_id) REFERENCES syndicates(id),
|
||||
FOREIGN KEY (invited_by_user_id) REFERENCES users(id),
|
||||
FOREIGN KEY (accepted_by_user_id) REFERENCES users(id)
|
||||
);`
|
||||
|
||||
Reference in New Issue
Block a user