fix(auth): route email confirmation and password reset through callback#27
Draft
julianromli wants to merge 1 commit into
Draft
fix(auth): route email confirmation and password reset through callback#27julianromli wants to merge 1 commit into
julianromli wants to merge 1 commit into
Conversation
- Add centralized getAuthCallbackUrl helpers in lib/constants/auth.ts - Point signup, resend, and reset email links at /auth/callback - Handle password recovery flow in callback and new reset-password page - Fix deleteBlogPost admin check to use users.role from database - Consolidate server getCurrentUser with lib/actions/user implementation - Allow reset-password route in proxy auth redirect logic Co-authored-by: faizntfd <faizintfd@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This repo does not have
src/auth.py(Python); auth lives in the Next.js/Supabase module underlib/server/auth.ts,lib/actions/*, andapp/auth/callback. This PR fixes several related auth bugs in that module.Changes
Email confirmation redirect chain
/or a bare site URL instead of/auth/callback./auth/callback, whereexchangeCodeForSessionruns, profiles are created, and users get the correct post-confirm flow.Password reset flow
/auth/callback?next=/user/auth/reset-password./user/auth/reset-passwordpage for setting a new password after the recovery link.proxy.tsso recovery sessions are not redirected away from the reset page.Admin authorization
deleteBlogPostcheckeduser_metadata.roleinstead of the databaseusers.role, so admins could be blocked from deleting posts. It now readsusers.rolelike other admin actions.Auth module consolidation
lib/server/auth.tsgetCurrentUser()now delegates tolib/actions/user.tswhile preserving the existing return shape for route consumers.Centralized redirect helpers
getAuthCallbackUrl()/getClientAuthCallbackUrl()inlib/constants/auth.tsto avoid inconsistent redirect URLs.Testing
bunx tsc --noEmit(no new auth-related errors; pre-existing unrelated errors remain)Notes
Ensure Supabase dashboard redirect URLs include
/auth/callback(seedocs/security/AUTH_DASHBOARD_SETTINGS.md).