feat: add resend capability for platform and account invite codes

Revoke-and-recreate flow for both invite systems with email delivery
via Resend API. Includes account invite email template and audit logging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-11 23:45:23 -05:00
parent a1f5127e98
commit 3c47292eaf
8 changed files with 390 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react'
import { Plus, Copy, Trash2, Ticket, Mail, MailCheck } from 'lucide-react'
import { Plus, Copy, Trash2, Ticket, Mail, MailCheck, RefreshCw } from 'lucide-react'
import { DataTable, PageHeader, StatusBadge, ActionMenu, EmptyState } from '@/components/admin'
import type { Column } from '@/components/admin'
import { Modal } from '@/components/common/Modal'
@@ -97,6 +97,16 @@ export function InviteCodesPage() {
}
}
const handleResend = async (code: string) => {
try {
const newInvite = await adminApi.resendInviteCode(code)
toast.success(`New code ${newInvite.code} sent to ${newInvite.email}`)
fetchCodes()
} catch {
toast.error('Failed to resend invite code')
}
}
const inputClass = cn(
'w-full rounded-md border border-white/10 bg-black/50 px-3 py-2 text-sm text-white',
'placeholder:text-white/40 focus:outline-none focus:border-white/30 focus:ring-2 focus:ring-white/20'
@@ -183,6 +193,11 @@ export function InviteCodesPage() {
icon: <Copy className="h-4 w-4" />,
onClick: () => handleCopy(c.code),
},
...(c.is_valid && c.email ? [{
label: 'Resend',
icon: <RefreshCw className="h-4 w-4" />,
onClick: () => handleResend(c.code),
}] : []),
...(!c.is_used ? [{
label: 'Delete',
icon: <Trash2 className="h-4 w-4" />,