unit(B1): invite -> pending -> approve/deny with console outbox
Admin-invite lifecycle (BUILD-PLAN Phase B, depends A3): - src/auth/invites.ts: pure nextUserStatus() rule (invite->pending_approval, approve->active, deny->denied) + isSignInEligible() mirroring the Auth.js authorize guard; thin DB wrappers inviteUser/approveUser/denyUser; enqueueOutbox() console transport (launch, ARCHITECTURE 3.4). - Routes: /api/dev/invite, /api/dev/approve, /api/dev/deny. - src/auth/invites.test.ts: 7 tests named after the rules. - magic-link.ts exports APP_ORIGIN. No migration: users.status already carries the enum (A2). Verify: typecheck, lint, 24 unit tests (+7), build, 4 e2e all green; runtime smoke test confirms invite->pending, approve->active signs in, deny->denied gets no session.
This commit is contained in:
@@ -32,7 +32,7 @@ const SECRET = new TextEncoder().encode(
|
||||
export const AUTO_ACTIVATE_NEW_USERS =
|
||||
process.env.AUTO_ACTIVATE_NEW_USERS !== "false";
|
||||
|
||||
const APP_ORIGIN =
|
||||
export const APP_ORIGIN =
|
||||
process.env.AUTH_URL ??
|
||||
process.env.NEXTAUTH_URL ??
|
||||
process.env.APP_ORIGIN ??
|
||||
|
||||
Reference in New Issue
Block a user