-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement comprehensive email confirmation flow #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add custom email templates with professional branding - Create dedicated email verification pages (/auth/verify, /auth/confirm) - Implement resend confirmation API endpoint - Update Supabase configuration for better URL handling - Add database migrations for improved user profile creation - Enhance user experience with clear instructions and status messages - Fix TypeScript errors and ensure code quality compliance Features: - Professional email templates with FrogBytes branding - Clear UI/UX for email verification process - Resend confirmation email functionality - Automatic redirect after successful confirmation - Better error handling and user feedback - Production-ready URL configuration
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Fix Next.js 15 build error by wrapping useSearchParams in Suspense - Update /auth/verify and /auth/confirm pages to use proper Suspense boundaries - Add loading fallbacks for better user experience - Resolve static generation issues with search params This fixes the build failure in GitHub Actions by ensuring useSearchParams() is properly wrapped in Suspense boundaries as required by Next.js 15 for static generation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 9 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="app/register/page.tsx">
<violation number="1" location="app/register/page.tsx:114">
Avoid placing the user’s email in the URL; it leaks PII through history, logs, and referrers. Prefer passing this data via protected storage (e.g., session storage or server state) and keep the URL free of PII.</violation>
</file>
<file name="supabase/migrations/20250127000003_email_confirmation_improvements.sql">
<violation number="1" location="supabase/migrations/20250127000003_email_confirmation_improvements.sql:61">
The SECURITY DEFINER function confirm_user_email lets any caller update auth.users by email alone, so an attacker can confirm arbitrary accounts without a token. Please remove or lock down this function so only a trusted backend or verification token can run the update.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| // Check if email confirmation is required | ||
| if (data.message && data.message.includes('check your email')) { | ||
| router.push('/login?registered=true&confirm=true') | ||
| router.push('/auth/verify?email=' + encodeURIComponent(email)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid placing the user’s email in the URL; it leaks PII through history, logs, and referrers. Prefer passing this data via protected storage (e.g., session storage or server state) and keep the URL free of PII.
Prompt for AI agents
Address the following comment on app/register/page.tsx at line 114:
<comment>Avoid placing the user’s email in the URL; it leaks PII through history, logs, and referrers. Prefer passing this data via protected storage (e.g., session storage or server state) and keep the URL free of PII.</comment>
<file context>
@@ -111,7 +111,7 @@ export default function RegisterPage() {
// Check if email confirmation is required
if (data.message && data.message.includes('check your email')) {
- router.push('/login?registered=true&confirm=true')
+ router.push('/auth/verify?email=' + encodeURIComponent(email))
} else {
router.push('/login?registered=true')
</file context>
|
|
||
| -- Update the user to confirm their email | ||
| UPDATE auth.users | ||
| SET email_confirmed_at = NOW(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SECURITY DEFINER function confirm_user_email lets any caller update auth.users by email alone, so an attacker can confirm arbitrary accounts without a token. Please remove or lock down this function so only a trusted backend or verification token can run the update.
Prompt for AI agents
Address the following comment on supabase/migrations/20250127000003_email_confirmation_improvements.sql at line 61:
<comment>The SECURITY DEFINER function confirm_user_email lets any caller update auth.users by email alone, so an attacker can confirm arbitrary accounts without a token. Please remove or lock down this function so only a trusted backend or verification token can run the update.</comment>
<file context>
@@ -0,0 +1,104 @@
+
+ -- Update the user to confirm their email
+ UPDATE auth.users
+ SET email_confirmed_at = NOW(),
+ updated_at = NOW()
+ WHERE id = user_id;
</file context>
- Add production domain URLs to Supabase configuration - Update registration API to use correct emailRedirectTo - Create migration for production URL configuration - Add comprehensive configuration guide for Supabase Dashboard This fixes the issue where email confirmation links redirect to localhost instead of the production domain. The solution includes: 1. Updated supabase/config.toml with production URLs 2. Modified registration API to use NEXT_PUBLIC_APP_URL 3. Created migration and documentation for manual configuration 4. Added step-by-step guide for Supabase Dashboard setup Critical: Manual configuration in Supabase Dashboard is still required for the production instance to use the correct redirect URLs.
🎯 Email Confirmation Flow Improvements
This PR implements a comprehensive email confirmation system that addresses the user registration issues and provides a much better user experience.
🔧 Key Improvements
1. Custom Email Templates
2. Enhanced User Experience
3. Technical Improvements
4. Database Enhancements
🚀 New Features
Professional Email Templates
Enhanced Verification Flow
Better Error Handling
🧪 Testing
📋 Files Changed
🎯 User Experience
Before: Users were confused about email confirmation and couldn't resend emails.
After:
This implementation provides a production-ready email confirmation system that will significantly improve the user registration experience!
Summary by cubic
Adds a complete email confirmation flow with branded emails, verify/confirm pages, and resend support. Improves sign-up UX and ensures reliable profile creation via updated DB triggers.
New Features
Migration