-
Notifications
You must be signed in to change notification settings - Fork 462
feat(clerk-js): Introduce reset password session task #7268
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
Merged
octoper
merged 39 commits into
main
from
vaggelis/user-4002-implement-the-aio-components-new-flow-and-session-task
Nov 28, 2025
Merged
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
48db5ac
feat(clerk-js): Initial work for reset password task
octoper 23c35e1
fix(clerk-js): Rename variable for clarity in SignInFactorOne component
octoper 2cf92e9
revert(clerk-js): Remove the logic for sign-in error on untrusted pas…
octoper f61d444
refactor(clerk-js): Remove 'untrustedPasswordMethods' from FlowMetada…
octoper f771b6a
chore(repo): Add changeset
octoper b032b92
feat(clerk-js): Implement TaskResetPassword component and update cont…
octoper 580026c
refactor(clerk-js): Simplify TaskResetPassword component by removing …
octoper ad66210
fix(clerk-js): Update localization keys in TaskResetPassword componen…
octoper e482de0
refactor(localization): Remove 'passwordUntrusted' key from en-US loc…
octoper d9a5d07
fix(clerk-js): Increase maxSize for sessionTasks.js in bundlewatch co…
octoper 0dd1b54
refactor(clerk-js): Reorder import statements in TaskChooseOrganizati…
octoper 2d03298
feat(clerk-js): Enhance tests and add localization key for the form b…
octoper ddf655d
feat(localization): Add 'taskResetPassword' localization keys
octoper 98952e0
fix(clerk-js): When we are on a url for a task that not exists anymor…
octoper 3c1b5f1
chore(clerk-js): Remove unused context import from TaskResetPassword …
octoper 036c93a
fix(clerk-js,localization): Remove redundant test for task order and …
octoper 84bc6aa
fix(clerk-js): Simplify navigation logic in session task components a…
octoper 05a57cc
fix(clerk-js): Update buildTasksUrl method to accept optional redirec…
octoper e6fc673
fix(clerk-js): Update buildTasksUrl method to accept optional TasksRe…
octoper e4febd7
feat(clerk-js,backend): Implement reset password session task and rel…
octoper 0f33ec8
tests(e2e): Update tests
octoper baa5c2b
fix(clerk-js): Revert navigation changes from TaskChooseOrganization
octoper bea6e4b
chore(clerk-js): Remove unused usage
octoper 205ec3b
Fix navigation for tasks within virtual router
LauraBeatris 2d6b3e2
Fix navigation to n+1 task within modal
LauraBeatris a8b5605
Move `withTaskGuard` to shared folder
LauraBeatris e515c50
Fix `withTaskGuard` import path
LauraBeatris d971e71
Render session task context for separate components
LauraBeatris 7e3dcf8
fix(clerk-js): Update token handling in Session class to ensure corre…
octoper ad7815c
fix(clerk-js): Enhance token resolve to ensure accurate token retriev…
octoper ad95b14
fix(clerk-js): Update token caching to use Promise.resolve for last a…
octoper 3e97845
wip
octoper 579ca04
fix(clerk-js): Revert changes
octoper 6a2ba9a
revert changes
octoper e7cc9d9
revert changes
octoper f4d8faa
fix: Revert buildTasksUrl changes
octoper 1cf4496
fix(clerk-js): Prevent components unmounting when current task changes
octoper 92f503b
fix(clerk-js): Prevent double navigation when resolving the last task
octoper f871d5a
fix(clerk-js): Remove uneeded changes
octoper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@clerk/localizations': minor | ||
| '@clerk/clerk-js': minor | ||
| '@clerk/shared': minor | ||
| --- | ||
|
|
||
| Introduce `reset-password` session task |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/backend': minor | ||
| --- | ||
|
|
||
| Introducing `users.__experimental_passwordUntrusted` action |
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
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
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
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
99 changes: 99 additions & 0 deletions
99
integration/tests/session-tasks-sign-in-reset-password.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { test } from '@playwright/test'; | ||
|
|
||
| import { hash } from '../models/helpers'; | ||
| import { appConfigs } from '../presets'; | ||
| import { createTestUtils, testAgainstRunningApps } from '../testUtils'; | ||
|
|
||
| testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword] })( | ||
| 'session tasks after sign-in reset password flow @nextjs', | ||
| ({ app }) => { | ||
| test.describe.configure({ mode: 'parallel' }); | ||
|
|
||
| test.afterAll(async () => { | ||
| await app.teardown(); | ||
| }); | ||
|
|
||
| test('resolve both reset password and organization selection tasks after sign-in', async ({ page, context }) => { | ||
| const u = createTestUtils({ app, page, context }); | ||
|
|
||
| const user = u.services.users.createFakeUser(); | ||
| const createdUser = await u.services.users.createBapiUser(user); | ||
|
|
||
| await u.services.users.passwordUntrusted(createdUser.id); | ||
|
|
||
| // Performs sign-in | ||
| await u.po.signIn.goTo(); | ||
| await u.po.signIn.setIdentifier(user.email); | ||
| await u.po.signIn.continue(); | ||
| await u.po.signIn.setPassword(user.password); | ||
| await u.po.signIn.continue(); | ||
|
|
||
| await u.page.getByRole('textbox', { name: 'code' }).click(); | ||
| await u.page.keyboard.type('424242', { delay: 100 }); | ||
|
|
||
| // Redirects back to tasks when accessing protected route by `auth.protect` | ||
| await u.page.goToRelative('/page-protected'); | ||
|
|
||
| const newPassword = `${hash()}_testtest`; | ||
| await u.po.sessionTask.resolveResetPasswordTask({ | ||
| newPassword: newPassword, | ||
| confirmPassword: newPassword, | ||
| }); | ||
|
|
||
| await u.po.sessionTask.resolveForceOrganizationSelectionTask({ | ||
| name: 'Test Organization', | ||
| }); | ||
|
|
||
| // Navigates to after sign-in | ||
| await u.page.waitForAppUrl('/page-protected'); | ||
|
|
||
| await u.page.signOut(); | ||
| await u.page.context().clearCookies(); | ||
|
|
||
| await user.deleteIfExists(); | ||
| await u.services.organizations.deleteAll(); | ||
| }); | ||
|
|
||
| test('sign-in with email and resolve the reset password task', async ({ page, context }) => { | ||
| const u = createTestUtils({ app, page, context }); | ||
| const user = u.services.users.createFakeUser(); | ||
| const createdUser = await u.services.users.createBapiUser(user); | ||
|
|
||
| await u.services.users.passwordUntrusted(createdUser.id); | ||
| const fakeOrganization = u.services.organizations.createFakeOrganization(); | ||
| await u.services.organizations.createBapiOrganization({ | ||
| ...fakeOrganization, | ||
| createdBy: createdUser.id, | ||
| }); | ||
|
|
||
| // Performs sign-in | ||
| await u.po.signIn.goTo(); | ||
| await u.po.signIn.setIdentifier(user.email); | ||
| await u.po.signIn.continue(); | ||
| await u.po.signIn.setPassword(user.password); | ||
| await u.po.signIn.continue(); | ||
|
|
||
| await u.page.getByRole('textbox', { name: 'code' }).fill('424242'); | ||
|
|
||
| await u.po.expect.toBeSignedIn(); | ||
|
|
||
| // Redirects back to tasks when accessing protected route by `auth.protect` | ||
| await u.page.goToRelative('/page-protected'); | ||
|
|
||
| const newPassword = `${hash()}_testtest`; | ||
| await u.po.sessionTask.resolveResetPasswordTask({ | ||
| newPassword: newPassword, | ||
| confirmPassword: newPassword, | ||
| }); | ||
|
|
||
| // Navigates to after sign-in | ||
| await u.page.waitForAppUrl('/page-protected'); | ||
|
|
||
| await u.page.signOut(); | ||
| await u.page.context().clearCookies(); | ||
|
|
||
| await user.deleteIfExists(); | ||
| await u.services.organizations.deleteAll(); | ||
| }); | ||
| }, | ||
| ); |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.