916ad39176
Deploy to route.crispygoat.com / deploy (push) Failing after 3m1s
- Add MinIO/S3-compatible storage client (src/lib/storage.ts) with uploadObject, deleteObject, presigned URL helpers, and BUCKETS constant - Wire product images, brand logos, and water log photos to MinIO via the new storage client - Migrate forgot-password to Neon Auth (remove Supabase /auth/v1/recover call) - Migrate send-scheduled cron to direct Postgres + Resend (remove Supabase Edge Function proxy) - Add logoUrl to email types (OrderReceipt, Welcome, PasswordReset) and pass brand_settings.logo_url from all call sites - Update email templates to use dynamic logoUrl instead of hardcoded Supabase bucket URLs - Remove hardcoded Supabase URLs from TuxedoVideoHero, TuxedoAboutPage, TimeTrackingFieldClient; use brand_settings props + local public/ fallback - Download brand logos (3) and tuxedo-hero.mp4 (36MB) from Supabase bucket to public/ for local development - Add MinIO env vars to .env.example (endpoint, access key, secret, buckets) - Fix TimeTrackingFieldClient to destructure logoUrl and brandAccent props - Fix admin/users.ts logoUrl type (null → undefined for optional string) - Remove stale sb- cookie from wholesale-auth - Migrate tuxedo/about page to remove supabase import and use pool query for wholesale_settings lookup
43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
"use server";
|
|
|
|
/**
|
|
* Wholesale customer authentication.
|
|
*
|
|
* TODO(migration): The original implementation used Supabase's
|
|
* `auth.signInWithPassword` for email/password login of wholesale
|
|
* customers. Now that Supabase is being removed, the wholesale
|
|
* customer auth needs to be rebuilt on top of Auth.js v5 (or a
|
|
* custom bcrypt + cookie session) before this module can be re-enabled.
|
|
*
|
|
* Until that lands, the actions below are stubbed: they preserve the
|
|
* original signatures so the login form renders without runtime
|
|
* errors, but always return a friendly "not available" error.
|
|
*
|
|
* Re-enable by:
|
|
* 1. Adding a `wholesale_customers` table (or extending
|
|
* `db/schema/customers.ts` with `password_hash` + `auth_user_id`).
|
|
* 2. Wiring up the chosen auth provider in `src/lib/auth.ts`.
|
|
* 3. Setting the `wholesale_session` cookie with the resolved
|
|
* customer id.
|
|
*/
|
|
|
|
import { cookies } from "next/headers";
|
|
|
|
export type WholesaleLoginResult =
|
|
| { success: true; token: string; userId: string; customerId: string }
|
|
| { success: false; error: string };
|
|
|
|
const NOT_AVAILABLE_ERROR =
|
|
"Wholesale customer login is temporarily unavailable while we rebuild authentication. Please contact your account manager.";
|
|
|
|
export async function wholesaleLoginAction(_formData: FormData): Promise<WholesaleLoginResult> {
|
|
return { success: false, error: NOT_AVAILABLE_ERROR };
|
|
}
|
|
|
|
export async function wholesaleLogoutAction(): Promise<{ success: true } | { success: false; error: string }> {
|
|
const cookieStore = await cookies();
|
|
// Best-effort cookie cleanup so a returning customer doesn't see stale state
|
|
cookieStore.delete("wholesale_session");
|
|
return { success: true };
|
|
}
|