Skip to content

feat(mosaic,nextjs): add TaskResetPassword - #11134

Draft
austincalvelage wants to merge 5 commits into
mainfrom
austin/mosaic-task-reset-password
Draft

austincalvelage wants to merge 5 commits into
mainfrom
austin/mosaic-task-reset-password

Conversation

@austincalvelage

Copy link
Copy Markdown
Member

Description

Adds TaskResetPassword to Mosaic and exports it from @clerk/nextjs/preview. It resolves the reset-password session task the way @clerk/ui's <TaskResetPassword /> does, built on Mosaic's model, controller and view split like TaskSetupMFA and TaskChooseOrganization.

Shared changes (for Mosaic reviewers)

  • The fake FAPI's POST /v1/me/change_password now removes reset-password from the session's tasks and activates the session when none is left, as CompleteSessionTask does in FAPI.
  • No new shared helper. The password check, the after-task navigation and the sign-out footer follow sign-up, TaskChooseOrganization and TaskSetupMFA. Each is now copied in three places, so a shared "continue after task" and password check are worth pulling out next.

1. The form matches ui's. New password and confirm password, with the instance's password rules shown live as the user types, and a "Sign out of all other devices" checkbox that starts checked. Clerk's password errors land on the new-password field through the same passwordFormError sign-up and user profile use.

await updatePassword(user, value); // { newPassword, signOutOfOtherSessions }, no currentPassword
await clerk.setActive({
  session: sessionId,
  navigate: ({ session: next, decorateUrl }) => continueAfterTask(next, decorateUrl),
});

2. Finishing goes where ui goes. After the password changes, the user continues to their next task through taskUrls or the built task URL, or to redirectUrlComplete when none is left. Step-up verification shows inline, as in TaskSetupMFA, where ui opens a modal.

3. The guards match withTaskGuard. A visitor with no session goes to sign-in, and a session without the task goes to redirectUrlComplete, falling back to the after-sign-in URL. The sign-out footer signs out only this session when others are signed in, as ui's does. Signing out mid-task leaves the user on the sign-out destination instead of redirecting to sign-in afterward.

JSDoc for review.

A card that resolves the reset-password session task: the user enters and confirms a new password, chooses whether to sign out of their other devices, and continues to their next task, or to redirectUrlComplete when none is left. It renders fallback until Clerk answers.

Mounted when the session has no reset-password task, it renders nothing and navigates to redirectUrlComplete, or to sign-in when nobody is signed in.

fallback: Rendered while Clerk loads.

Known gaps

  • ui shows a green "Passwords match." under the confirm field. Mosaic shows only the mismatch, as its user-profile password dialog does.
  • The button reads "Reset password", in Mosaic's sentence case, where ui has "Reset Password".
  • Nothing in Mosaic mounts this task at /sign-in#/tasks/reset-password yet, so an app mounts it or sets taskUrls, as with TaskSetupMFA.
  • TaskSetupMFA navigates twice after a footer sign-out, and its finish ignores taskUrls. This PR doesn't change it.
  • Not run against a real instance. The tests use the fake FAPI.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

…nges a password

FAPI removes the reset-password task from the requesting session when the password changes, and the session becomes active once no task is left. The fake now does the same, so a feature test can follow a reset into the next task or redirectUrlComplete.
Port the behaviors the legacy TaskResetPassword tests cover, and the task guard, completion, reverification, password checks and multi-session sign-out, as one feature test against the fake FAPI. The tests fail until TaskResetPassword exists.
Add a Mosaic TaskResetPassword that resolves the reset-password session task with legacy parity: a new password and its confirmation, live password rules, field errors for passwords Clerk rejects, the sign-out-of-other-devices choice, step-up verification when Clerk asks for it, and a footer that signs out this account or every account. On success it continues to the next task or redirectUrlComplete. Export it and its props from @clerk/mosaic/ui and @clerk/nextjs/preview.
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 5, 2026 10:07pm UTC
mosaic-docs Ready Ready Preview Dec 5, 2026 10:07pm UTC
swingset Ready Ready Preview Dec 5, 2026 10:07pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@changeset-bot

changeset-bot Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6af3352

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@clerk/mosaic Minor
@clerk/nextjs Minor
@clerk/mosaic-docs Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@11134

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@11134

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@11134

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@11134

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11134

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11134

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11134

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@11134

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@11134

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11134

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11134

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@11134

@clerk/express

npm i https://pkg.pr.new/@clerk/express@11134

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@11134

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@11134

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@11134

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11134

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@11134

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@11134

@clerk/react

npm i https://pkg.pr.new/@clerk/react@11134

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@11134

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@11134

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@11134

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@11134

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@11134

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@11134

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@11134

commit: 6af3352

This branch was successfully deployed

2 active deployments
Preview – swingset — 6af33520 Deployed Dec 5, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 6af33520 Deployed Dec 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant