Skip to content

Commit

Permalink
fix: correct redirect url if its from cloudfront (#92)
Browse files Browse the repository at this point in the history
* fix: correct redirect url if from cloudfront

* use relative url helper

---------

Co-authored-by: Dax Raad <d@ironbay.co>
  • Loading branch information
nhamilton1 and thdxr authored Dec 26, 2024
1 parent d8d1580 commit ce44ed6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-mails-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openauthjs/openauth": patch
---

fix for password adapter not redirecting to the right place after change password flow
6 changes: 3 additions & 3 deletions packages/openauth/src/adapter/password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ export function PasswordAdapter(config: PasswordConfig) {
})

routes.get("/change", async (c) => {
const redirect =
c.req.query("redirect_uri") ||
c.req.url.replace(/change.*/, "authorize")
let redirect =
c.req.query("redirect_uri") || getRelativeUrl(c, "./authorize")
const state: PasswordChangeState = {
type: "start",
redirect,
Expand Down Expand Up @@ -368,6 +367,7 @@ export function PBKDF2Hasher(opts?: { interations?: number }): PasswordHasher<{
}
}
import { timingSafeEqual, randomBytes, scrypt } from "node:crypto"
import { getRelativeUrl } from "../util.js"

export function ScryptHasher(opts?: {
N?: number
Expand Down

0 comments on commit ce44ed6

Please sign in to comment.