mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 21:06:04 +00:00
fix logout by setting the api route as logout target
This commit is contained in:
@@ -347,6 +347,7 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logout(c: Context<ServerEnv>) {
|
async logout(c: Context<ServerEnv>) {
|
||||||
|
$console.info("Logging out");
|
||||||
c.set("auth", undefined);
|
c.set("auth", undefined);
|
||||||
|
|
||||||
const cookie = await this.getAuthCookie(c);
|
const cookie = await this.getAuthCookie(c);
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ export class AdminController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get basepath() {
|
get basepath() {
|
||||||
return this.options.basepath ?? "/";
|
return this.options.adminBasepath ?? "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
private withBasePath(route: string = "") {
|
private withBasePath(route: string = "") {
|
||||||
return (this.basepath + route).replace(/(?<!:)\/+/g, "/");
|
return (this.options.basepath + route).replace(/(?<!:)\/+/g, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private withAdminBasePath(route: string = "") {
|
private withAdminBasePath(route: string = "") {
|
||||||
@@ -80,7 +80,7 @@ export class AdminController extends Controller {
|
|||||||
loggedOut: configs.auth.cookie.pathLoggedOut ?? this.withAdminBasePath("/"),
|
loggedOut: configs.auth.cookie.pathLoggedOut ?? this.withAdminBasePath("/"),
|
||||||
login: this.withAdminBasePath("/auth/login"),
|
login: this.withAdminBasePath("/auth/login"),
|
||||||
register: this.withAdminBasePath("/auth/register"),
|
register: this.withAdminBasePath("/auth/register"),
|
||||||
logout: this.withAdminBasePath("/auth/logout"),
|
logout: "/api/auth/logout",
|
||||||
};
|
};
|
||||||
|
|
||||||
const paths = ["/", "/data/*", "/auth/*", "/media/*", "/flows/*", "/settings/*"];
|
const paths = ["/", "/data/*", "/auth/*", "/media/*", "/flows/*", "/settings/*"];
|
||||||
|
|||||||
Reference in New Issue
Block a user