feat: two-factor sign-in, required for sensitive permissions
Better Auth's twoFactor plugin: an authenticator app (TOTP) with 10 backup codes. Turning it on, making new backup codes and turning it off are on the account page, and signing in asks for a code once it's on. Sensitive permissions (product:remove, person:ban, person:role, settings:edit, catalog:suspend, ...) answer 403 two_factor_required without it, API tokens included; the console reminds people who need it. Better Auth's own admin endpoints are closed (404). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
69c55a72fb
commit
d5bc792190
28 files changed
+4365
-62
No files matched your search
@@ -36,6 +36,7 @@ export default async function PersonPage({ params }: { params: Promise<{ id: str
|
||||
</span>
|
||||
{person.banned && <Tag tone="danger">banned: {person.banReason}</Tag>}
|
||||
{!person.approved && <Tag tone="strong">waiting for approval</Tag>}
|
||||
{person.twoFactor && <Tag>two-factor on</Tag>}
|
||||
</span>
|
||||
</PageHeader>
|
||||
<ConsoleNav />
|
||||
|
||||
@@ -65,7 +65,12 @@ export default async function People({
|
||||
{p.username}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className="capitalize">{p.role}</TableCell>
|
||||
<TableCell>
|
||||
<span className="capitalize">{p.role}</span>
|
||||
{p.role !== "user" && !p.twoFactor && (
|
||||
<span className="ml-2 text-xs text-muted-foreground">no two-factor</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="tabular-nums">{p.linkCap}</TableCell>
|
||||
<TableCell className="text-muted-foreground">
|
||||
<DateTime iso={p.createdAt} dateOnly />
|
||||
|
||||
Reference in new issue
Block a user