mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
auth: add delete auth after flash in case only one is picked up
This commit is contained in:
@@ -342,9 +342,9 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
|||||||
await setSignedCookie(c, "auth", token, secret, this.cookieOptions);
|
await setSignedCookie(c, "auth", token, secret, this.cookieOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async deleteAuthCookie(c: Context) {
|
private deleteAuthCookie(c: Context) {
|
||||||
$console.debug("deleting auth cookie");
|
$console.debug("deleting auth cookie");
|
||||||
await deleteCookie(c, "auth", this.cookieOptions);
|
deleteCookie(c, "auth", this.cookieOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
async logout(c: Context<ServerEnv>) {
|
async logout(c: Context<ServerEnv>) {
|
||||||
@@ -353,9 +353,13 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
|||||||
|
|
||||||
const cookie = await this.getAuthCookie(c);
|
const cookie = await this.getAuthCookie(c);
|
||||||
if (cookie) {
|
if (cookie) {
|
||||||
await this.deleteAuthCookie(c);
|
addFlashMessage(c, "Signed out", "info");
|
||||||
await addFlashMessage(c, "Signed out", "info");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on waku, only one cookie setting is performed
|
||||||
|
// therefore adding deleting cookie at the end
|
||||||
|
// as the flash isn't that important
|
||||||
|
this.deleteAuthCookie(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: move this to a server helper
|
// @todo: move this to a server helper
|
||||||
|
|||||||
Reference in New Issue
Block a user