From 4329c2890436e5d1581a95a4b242960879fdf6b5 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 11 May 2023 13:29:35 +0800 Subject: [PATCH 1/2] On password reset clear the auth cookie --- packages/api/src/routers/auth/auth_router.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/api/src/routers/auth/auth_router.ts b/packages/api/src/routers/auth/auth_router.ts index 0b4b5266c..2e41eb5dc 100644 --- a/packages/api/src/routers/auth/auth_router.ts +++ b/packages/api/src/routers/auth/auth_router.ts @@ -596,6 +596,7 @@ export function authRouter() { ) } + res.cookie('auth', '', { expires: new Date() }) res.redirect(`${env.client.url}/auth/reset-sent`) } catch (e) { logger.info('forgot-password exception:', e) From 78681df4abdcfc5b1592f4443623698268310e50 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 11 May 2023 13:32:43 +0800 Subject: [PATCH 2/2] Use clearCookie, rm the pending auth cookie too --- packages/api/src/routers/auth/auth_router.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/api/src/routers/auth/auth_router.ts b/packages/api/src/routers/auth/auth_router.ts index 2e41eb5dc..d1439ef30 100644 --- a/packages/api/src/routers/auth/auth_router.ts +++ b/packages/api/src/routers/auth/auth_router.ts @@ -596,7 +596,8 @@ export function authRouter() { ) } - res.cookie('auth', '', { expires: new Date() }) + res.clearCookie('auth') + res.clearCookie('pendingUserAuth') res.redirect(`${env.client.url}/auth/reset-sent`) } catch (e) { logger.info('forgot-password exception:', e)