mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
added a redirect param to password strategy
This commit is contained in:
@@ -299,8 +299,8 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
||||
}
|
||||
}
|
||||
|
||||
private getSuccessPath(c: Context) {
|
||||
const p = (this.config.cookie.pathSuccess ?? "/").replace(/\/+$/, "/");
|
||||
private getSafeUrl(c: Context, path: string) {
|
||||
const p = path.replace(/\/+$/, "/");
|
||||
|
||||
// nextjs doesn't support non-fq urls
|
||||
// but env could be proxied (stackblitz), so we shouldn't fq every url
|
||||
@@ -316,7 +316,10 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
||||
return c.json(data);
|
||||
}
|
||||
|
||||
const successUrl = this.getSuccessPath(c);
|
||||
const successUrl = this.getSafeUrl(
|
||||
c,
|
||||
redirect ? redirect : (this.config.cookie.pathSuccess ?? "/")
|
||||
);
|
||||
const referer = redirect ?? c.req.header("Referer") ?? successUrl;
|
||||
//console.log("auth respond", { redirect, successUrl, successPath });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user