Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Fix EMAIL_NOT_VERIFIED error handling in login form
  • Error via onError callback now properly redirects to /verify instead of leaving user stuck

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 22, 2026 2:25am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 22, 2026

Greptile Summary

Fixed EMAIL_NOT_VERIFIED error handling in login form by adding proper redirect logic to the onError callback. Previously, when this error occurred, the callback would only set errorHandled = true without actually redirecting the user to the verification page, leaving users stuck on the login screen.

  • Added sessionStorage.setItem('verificationEmail', email) to store the email for the verification page
  • Added router.push('/verify') to redirect users to email verification
  • Removed misleading comment claiming the catch block handles this case (the onError callback executes first, preventing the catch block from running)
  • Matches the existing pattern used in the signup form at apps/sim/app/(auth)/signup/signup-form.tsx:330
  • The catch block at line 288 still provides fallback handling for edge cases where the error might not be caught by the onError callback

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward bug fix that adds the missing redirect logic for unverified email errors. The implementation follows the existing pattern used in the signup form, uses proper SSR checks (typeof window !== 'undefined'), and correctly sets the email in sessionStorage before redirecting. The fallback catch block at line 288 remains in place for redundancy.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/(auth)/login/login-form.tsx Fixed EMAIL_NOT_VERIFIED error handling by adding proper redirect logic and sessionStorage update in onError callback

Sequence Diagram

sequenceDiagram
    participant U as User
    participant LF as Login Form
    participant AC as Auth Client
    participant SS as SessionStorage
    participant R as Router
    participant VP as Verify Page

    U->>LF: Submit login credentials
    LF->>AC: signIn.email()
    AC-->>LF: onError: EMAIL_NOT_VERIFIED
    LF->>LF: Set errorHandled = true
    LF->>SS: setItem('verificationEmail', email)
    LF->>R: push('/verify')
    R->>VP: Navigate to /verify
    VP->>SS: getItem('verificationEmail')
    VP->>U: Display verification form with email
Loading

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit f3fcc28 into staging Jan 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants