feat: enhance sign-up process with email verification flow and error handling. Introduce new toast messages for verification success and continuation, and implement duplicate email error detection. Update sign-up form to streamline user experience and improve feedback during the verification process.
f133948 Download apps/web/src/lib/signup-errors.ts from Atmint/cpns: direct link, hf CLI and curl.
- Browser
- Download file 808 Bytes
-
https://huggingface.co/spaces/Atmint/cpns/resolve/main/apps/web/src/lib/signup-errors.ts
- Command line
-
hf download hf://spaces/Atmint/cpns/apps/web/src/lib/signup-errors.ts
-
curl -L -o signup-errors.ts https://huggingface.co/spaces/Atmint/cpns/resolve/main/apps/web/src/lib/signup-errors.ts
808 Bytes
| /** Better Auth signup error shape from authClient.signUp.email onError */ | |
| type SignUpErrorPayload = { | |
| error?: { | |
| message?: string; | |
| statusText?: string; | |
| status?: number; | |
| code?: string; | |
| }; | |
| }; | |
| /** | |
| * Heuristic for duplicate-email signup failures. | |
| * Used only to choose UX path — never show raw message to users (enumeration risk). | |
| */ | |
| export function isSignUpDuplicateError(error: SignUpErrorPayload): boolean { | |
| const msg = `${error.error?.message ?? ""} ${error.error?.statusText ?? ""} ${error.error?.code ?? ""}`.toLowerCase(); | |
| if (error.error?.status === 409 || error.error?.status === 422) return true; | |
| return ( | |
| msg.includes("already") || | |
| msg.includes("exists") || | |
| msg.includes("unique") || | |
| msg.includes("duplicate") || | |
| msg.includes("user_already") | |
| ); | |
| } | |