Skip to content

Commit d07920c

Browse files
authored
Merge pull request #50 from Krish-2118/development
registration flow and supabase fix
2 parents 7761f19 + 92300cf commit d07920c

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎docs/pass-experience.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The live flow is Google login → participant details → payment QR → screens
44

55
## Reviewer preview and the single off switch
66

7-
`REGISTRATION_PREVIEW_ENABLED` in `src/config/launch.ts` is currently **true**. Set it to **false** and redeploy to remove all preview entry points, mock users, local uploads and simulated approval. There is no UI toggle. This is independent of `REGISTRATIONS_OPEN`, which controls whether live registration is open.
7+
`REGISTRATION_PREVIEW_ENABLED` in `src/config/launch.ts` is currently **false**: every preview entry point, mock user, local upload and simulated approval is off. Set it to **true** and redeploy only to bring the reviewer preview back for a review build. There is no UI toggle. This is independent of `REGISTRATIONS_OPEN`, which controls whether live registration is open.
88

99
- `/?preview=register` starts all steps, with a blank college field.
1010
- Preview participants select a local screenshot and enter a 12-digit test UTR. No payment, registration, upload or acknowledgement is sent to the server.

‎src/app/api/pass/experience/route.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextRequest, NextResponse } from 'next/server';
22
import { getAuthenticatedUser } from '@/lib/auth-server';
33
import { getSupabaseAsUser } from '@/lib/supabase';
4-
import { createRateLimiter } from '@/lib/security';
4+
import { createRateLimiter, readJsonObject } from '@/lib/security';
55
import { entryRateLimited, entryRpcFailure } from '@/lib/entry-route';
66

77
const limiter = createRateLimiter({ limit: 40, windowMs: 60_000 });
@@ -11,8 +11,10 @@ export async function POST(req: NextRequest) {
1111
if (!auth) return NextResponse.json({ error: 'Sign in required.' }, { status: 401 });
1212
const limited = entryRateLimited(limiter, auth.user.id);
1313
if (limited) return limited;
14-
const body = await req.json().catch(() => null);
15-
if (!body || !['claim', 'acknowledge'].includes(body.action) ||
14+
const parsed = await readJsonObject(req);
15+
if (!parsed.ok) return NextResponse.json({ error: parsed.error }, { status: parsed.status });
16+
const body = parsed.value;
17+
if (typeof body.action !== 'string' || !['claim', 'acknowledge'].includes(body.action) ||
1618
typeof body.claim !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(body.claim)) {
1719
return NextResponse.json({ error: 'Invalid experience request.' }, { status: 400 });
1820
}

‎src/config/launch.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
export const REGISTRATIONS_OPEN = true;
1717
export const MERCH_STORE_OPEN = true;
1818

19-
/** Review-only registration preview. Set false and redeploy to disable ALL mock users,
19+
/** Review-only registration preview. Keep false in production: false disables ALL mock users,
2020
* preview links, simulated uploads and simulated approval. Real API authorization is
2121
* always enforced; preview data is kept in memory and never submitted to the backend. */
22-
export const REGISTRATION_PREVIEW_ENABLED = true;
22+
export const REGISTRATION_PREVIEW_ENABLED = false;
2323

2424
/** Where the REGISTER buttons point while registrations are closed. */
2525
export const REGISTRATIONS_SOON_PATH = '/register';

‎supabase/schema.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ REVOKE EXECUTE ON FUNCTION public.new_referral_code() FROM PUBLIC, anon, authent
14101410
REVOKE EXECUTE ON FUNCTION public.assign_referral_code() FROM PUBLIC, anon, authenticated, service_role;
14111411

14121412

1413-
-- Durable one-time approval presentation
1413+
-- 15. PASS EXPERIENCE (durable one-time approval presentation)
14141414
-- Apply once before deploying the pass reveal. Also included in schema.sql for new installs.
14151415
-- No payment or registration fields are written by these functions.
14161416
CREATE TABLE IF NOT EXISTS public.pass_experiences (

0 commit comments

Comments
 (0)