Skip to content
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

feat: Reset password #8962

Merged
merged 18 commits into from
Sep 6, 2024
Merged

feat: Reset password #8962

merged 18 commits into from
Sep 6, 2024

Conversation

olivermrbl
Copy link
Contributor

@olivermrbl olivermrbl commented Sep 3, 2024

Generate reset password token:

  • POST /auth/user/emailpass/reset-password { identifier: "oli@oli.com" }
  • Execute generateResetPasswordToken workflow
    • Call generateToken
    • Emit event with token
  • Respond with 201 CREATED

Reset password:

  • POST /auth/user/emailpass/update?token="..." { email: "oli@oli.com", password: "***" }
  • Validate token in middleware
  • Call authModule.updateProvider
  • Call authProvider.update
    • Hash new password
    • Update provider identity with new hashed password
  • Respond with 200

Copy link

vercel bot commented Sep 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 9:59am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Sep 6, 2024 9:59am
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 9:59am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 9:59am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 9:59am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 9:59am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 9:59am

Copy link

changeset-bot bot commented Sep 3, 2024

⚠️ No Changeset found

Latest commit: b868e59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

adminHeaders
)
).data.invite
describe("Full authentication lifecycle", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are existing tests

const signup = await api
.post("/auth/user/emailpass/register", {
email: "admin@medusa.js",
describe("Reset password flows", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are new tests

Copy link
Contributor

@riqwan riqwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, added some questions/suggestions

integration-tests/http/__tests__/auth/admin/auth.spec.ts Outdated Show resolved Hide resolved
packages/core/types/src/auth/provider.ts Outdated Show resolved Hide resolved
@olivermrbl olivermrbl changed the title Feat/reset password [WIP] Feat/reset password Sep 3, 2024
@olivermrbl olivermrbl changed the title [WIP] Feat/reset password feat: Reset password Sep 6, 2024
@olivermrbl olivermrbl marked this pull request as ready for review September 6, 2024 06:51
@olivermrbl olivermrbl requested a review from a team as a code owner September 6, 2024 06:52
@olivermrbl olivermrbl marked this pull request as draft September 6, 2024 07:45
Copy link
Member

@sradevski sradevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, just one security concern, otherwise LGTM

Copy link
Member

@sradevski sradevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice one, I was someone asking if we'll support resets just today, so timely as well 😄

@sradevski
Copy link
Member

@olivermrbl I'll merge this one so I can do the rebase conflicts

@sradevski sradevski merged commit e27056b into develop Sep 6, 2024
23 checks passed
@sradevski sradevski deleted the feat/reset-password branch September 6, 2024 10:28
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.

3 participants