From 2805cb7cb68cae0f25bd43f166e4a6b8501d41eb Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Fri, 4 Dec 2020 22:13:11 +0100 Subject: server/mw/oauth: res.loc.auth to true upon auth Setting res.locals.authenticated explicity to true makes it's more clear whether the req is authenticated when using optionalAuthenticate middlware. --- server/middlewares/oauth.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'server/middlewares') diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index ab5301415..ffc1b7ca9 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts @@ -20,6 +20,8 @@ function authenticate (req: express.Request, res: express.Response, next: expres .end() } + res.locals.authenticated = true + return next() }) } -- cgit v1.2.3