Skip to content

feat: add forgot password and reset password pages - #363

Merged
daniellehonn merged 2 commits into
membership_portalfrom
feat/315-forgot-password
Nov 5, 2026
Merged

daniellehonn merged 2 commits into
membership_portalfrom
feat/315-forgot-password

Conversation

@bryanzhang3

@bryanzhang3 bryanzhang3 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #315

The "forgot password?" link on /login opened a 404. This adds the two missing pages. Both are adapted from origin/new_auth_pages (e79e006), which was never tested, with the fixes below.

  • /forgot-password: one email field. It calls supabase.auth.resetPasswordForEmail with redirectTo set to ${window.location.origin}/reset-password. It shows the same "if an account exists…" message whether or not the email has an account, and only logs Supabase errors to the console.
  • /reset-password: the browser client (PKCE) swaps the ?code= from the email link for a session when the page loads. The page waits for that with getSession(), then shows either the form or an "invalid or expired" message with a link to request a new one. The new password must be 8+ characters (same rule as signup) and both fields must match. It saves with supabase.auth.updateUser({ password }), signs out every other session with signOut({ scope: "others" }), then goes to /portal.

window.location.origin is used on purpose instead of NEXT_PUBLIC_SITE_URL. The PKCE verifier is stored in that site's cookies, so the link only works if it returns to the same site the request came from. That's also why previews work without extra config.

Supabase config

Redirect URLs allow list (Auth → URL Configuration):

  • https://portal.creativelabsucla.com/** (already present, covers production)
  • https://*--cl-portal-ucla.netlify.app/** (deploy previews + branch deploy)
  • http://localhost:3000/** (local)

Testing

  • tsc and eslint are clean on the new files.
  • On the dev server, /forgot-password and /reset-password load (200).
  • Full flow on this PR's deploy preview with a real UCLA account: request a reset, click the email link in the same browser, set a new password, land on /portal, log out, and log back in with the new password.
  • Same flow on portal.creativelabsucla.com after merge.

Known limit: the email link has to be opened in the same browser that requested it, because of the PKCE flow. Otherwise the page shows the "invalid or expired" message.

The login page linked to /forgot-password, which did not exist. The forgot page sends a Supabase reset email and shows the same message for every address. The reset page waits for the session from the email link, sets a new password of 8+ characters, and sends the user to /portal.
@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cl-official ready!

Name Link
🔨 Latest commit ec34c7e
🔍 Latest deploy log https://app.netlify.com/projects/cl-official/deploys/6ae3e403fa852502cac7a9b4
😎 Deploy Preview https://deploy-preview-363--cl-official.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cl-portal-ucla ready!

Name Link
🔨 Latest commit ec34c7e
🔍 Latest deploy log https://app.netlify.com/projects/cl-portal-ucla/deploys/6ae3e40347a687d00b62d5bf
😎 Deploy Preview https://deploy-preview-363--cl-portal-ucla.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@daniellehonn
daniellehonn merged commit 16d6860 into membership_portal Nov 5, 2026
10 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