Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
fern authored and fern committed Dec 9, 2024
1 parent a755155 commit 883687f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export default async function GET(req: NextRequest): Promise<NextResponse> {
};
const expires = token.exp == null ? undefined : new Date(token.exp * 1000);
// TODO: validate allowlist of domains to prevent open redirects
const res = redirectLocation ? FernNextResponse.redirect(req, redirectLocation.toString()) : NextResponse.next();
const res = redirectLocation
? FernNextResponse.redirect(req, redirectLocation.toString())
: NextResponse.next();
res.cookies.set(
COOKIE_FERN_TOKEN,
await signFernJWT(fernUser),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export default async function GET(req: NextRequest): Promise<NextResponse> {
code,
});

const res = redirectLocation ? FernNextResponse.redirect(req, redirectLocation.toString()) : NextResponse.next();
const res = redirectLocation
? FernNextResponse.redirect(req, redirectLocation.toString())
: NextResponse.next();
res.cookies.set("access_token", accessToken, withSecureCookie(withDefaultProtocol(host)));
return res;
} catch (error) {
Expand Down
6 changes: 2 additions & 4 deletions packages/ui/docs-bundle/src/server/FernNextResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ export class FernNextResponse {
let redirectLocation = new URL(destination);

// sanitize potentially problematic open redirects
if (
new URL(destination).host !== new URL(withDefaultProtocol(domain)).host
) {
if (new URL(destination).host !== new URL(withDefaultProtocol(domain)).host) {
redirectLocation = new URL(withDefaultProtocol(domain));
}

return NextResponse.redirect(redirectLocation);
}
}
}

0 comments on commit 883687f

Please sign in to comment.