Conversation
|
Someone is attempting to deploy a commit to the Dub Team on Vercel. A member of the Team first needs to authorize it. |
|
aman seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📝 WalkthroughWalkthroughThis change adds validation and guard logic to the email verification form to prevent duplicate OTP submissions. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi maintainers, this is my first contribution. Let me know if any changes are needed. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/ui/auth/register/verify-email-form.tsx (1)
34-40:⚠️ Potential issue | 🔴 Critical
isRedirectingis never reset on sign-in failure — form becomes permanently locked.If
signInreturnsok: false(or throws),isRedirectingstaystrue, the button remains disabled, andhandleVerifybails out. The user is stuck with no way to retry.Proposed fix
if (response?.ok) { router.push("/onboarding"); } else { + setIsRedirecting(false); toast.error( "Failed to sign in with credentials. Please try again or contact support.", ); }Also consider wrapping the
signIncall in a try/catch to handle network errors:+ try { const response = await signIn("credentials", { email, password, redirect: false, }); if (response?.ok) { router.push("/onboarding"); } else { + setIsRedirecting(false); toast.error( "Failed to sign in with credentials. Please try again or contact support.", ); } + } catch { + setIsRedirecting(false); + toast.error("Something went wrong. Please try again."); + }
🤖 Fix all issues with AI agents
In `@apps/web/ui/auth/register/verify-email-form.tsx`:
- Around line 78-79: The comment "Trim code input slightly for safety" is
misleading because setCode(code) doesn't trim; update the handler that calls
setCode (the place where the local variable code is set) to actually trim
whitespace before storing (e.g., call setCode(code.trim())) or remove/edit the
comment to match behavior; ensure you update the comment near setCode(...) in
verify-email-form.tsx to reflect the change and keep the trimming consistent
wherever the input is normalized.
- Around line 54-59: handleVerify currently closes over stale code state and
returns early when called from input-otp.onComplete; change handleVerify to
accept an optional parameter (e.g., completedCode?: string) and use
completedCode ?? code for validation and for the executeAsync call (keep the
isPending/isRedirecting checks). Then update the input-otp onComplete prop to
call handleVerify with the completed value so auto-submit uses the fresh OTP;
apply the same change to the second occurrence (the handler around lines
105-108) to ensure both auto-submit paths use the passed value instead of stale
state.
🧹 Nitpick comments (1)
apps/web/ui/auth/register/verify-email-form.tsx (1)
123-124: Formatting nit: missing space before!code.Proposed fix
- disabled={ isPending || isRedirecting ||!code || code.length < 6} + disabled={isPending || isRedirecting || !code || code.length < 6}
a1a85dd to
2a7204b
Compare
2a7204b to
44b8d78
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/web/ui/auth/register/verify-email-form.tsx`:
- Around line 54-59: The handleVerify function's body and closing brace are
mis-indented; reformat the block so the body statements (the guard return on
isPending/isRedirecting, computing finalCode, the length check, and the
executeAsync call) are indented one level inside the handleVerify declaration
and the closing brace aligns with the function declaration. Locate the
handleVerify declaration and adjust indentation for its internal statements and
closing brace so they are not flush with the function signature (references:
handleVerify, isPending, isRedirecting, finalCode, code, executeAsync).
🧹 Nitpick comments (1)
apps/web/ui/auth/register/verify-email-form.tsx (1)
95-95: Nit: extra leading space on closing</div>.Line 95 has one extra space of indentation compared to its opening tag on line 93. Likely a whitespace slip.
This PR fixes a small issue in the OTP verification flow.
What was happening
VerifyEmailFormcould callexecuteAsynctwice:This could lead to duplicate verification/account creation attempts.
What changed
Added a simple
handleVerifyguard to make sure the request only runs once while pending or redirecting.Result
OTP verification now triggers only a single request, making the signup flow more stable.
Summary by CodeRabbit