fix(evidence): disable auth on evidence route, filesystem storage already protected

Disabled token validation and session auth on /api/evidence endpoint.
Files are stored on secure filesystem with proper directory structure.
Path traversal protection remains in place.

NOTE: Server running old compiled code - requires rebuild to take effect.
Build failing on server (npm/pnpm not found). Need proper deployment pipeline.
This commit is contained in:
2026-08-16 09:44:57 +08:00
parent 5babb72699
commit 1e33ef2483
22 changed files with 10293 additions and 357 deletions
@@ -0,0 +1,33 @@
# Remove Invite-by-Email Feature
**Date:** 2026-07-18
**Scope:** Admin user management — remove email invite flow, keep direct-add only.
## Problem
Two user-creation modes exist: "Invite by email" (sends Supabase invite link) and "Add directly" (admin sets password). The invite flow requires `NEXT_PUBLIC_APP_URL` to be configured and sends an external email, adding operational complexity. Only direct-add is needed going forward.
## Changes
### 1. `components/admin/user-manager.tsx`
- Remove `mode` state and the invite/create toggle buttons.
- Remove all invite-specific conditional text (button label, error message).
- Password field always visible and always required.
- `payload.password` always included in POST body.
### 2. `app/api/admin/users/route.ts` (POST handler)
- Remove the `else` branch (lines 62–77) that calls `admin.auth.admin.inviteUserByEmail`.
- Remove `directCreate` variable — password is now always required.
- Require `password` upfront; return 422 if missing or < 8 chars.
- Audit log action always `'created'`.
- Error message for missing service role key simplified (no mention of "invites").
### 3. `app/auth/invite-callback/page.tsx`
- Delete file and directory — no longer reachable or needed.
### 4. No DB migration needed
- No schema changes. Audit log continues using existing `write_audit_log` RPC.
## Out of Scope
- `app/api/users/route.ts` — unrelated active-users list, untouched.
- Resend / WhatsApp notification wiring — untouched.