From e939debba58453066edd4799fb402c9fa352aa04 Mon Sep 17 00:00:00 2001 From: dswbx Date: Sat, 5 Jul 2025 09:43:14 +0200 Subject: [PATCH] auth: add delete auth after flash in case only one is picked up --- app/src/auth/authenticate/Authenticator.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/auth/authenticate/Authenticator.ts b/app/src/auth/authenticate/Authenticator.ts index 29b6597..d28ec4a 100644 --- a/app/src/auth/authenticate/Authenticator.ts +++ b/app/src/auth/authenticate/Authenticator.ts @@ -342,9 +342,9 @@ export class Authenticator = Record< await setSignedCookie(c, "auth", token, secret, this.cookieOptions); } - private async deleteAuthCookie(c: Context) { + private deleteAuthCookie(c: Context) { $console.debug("deleting auth cookie"); - await deleteCookie(c, "auth", this.cookieOptions); + deleteCookie(c, "auth", this.cookieOptions); } async logout(c: Context) { @@ -353,9 +353,13 @@ export class Authenticator = Record< const cookie = await this.getAuthCookie(c); if (cookie) { - await this.deleteAuthCookie(c); - await addFlashMessage(c, "Signed out", "info"); + 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