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.
pull/3432/head
kontrollanten 2020-12-04 22:13:11 +01:00 committed by Chocobozzz
parent f17faefb30
commit 2805cb7cb6
2 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,8 @@ function authenticate (req: express.Request, res: express.Response, next: expres
.end() .end()
} }
res.locals.authenticated = true
return next() return next()
}) })
} }

View File

@ -53,7 +53,7 @@ describe('Test plugin helpers', function () {
statusCodeExpected: 200 statusCodeExpected: 200
}) })
expect(res.body.isAuthenticated).to.equal(undefined) expect(res.body.isAuthenticated).to.equal(true)
const secRes = await makeGetRequest({ const secRes = await makeGetRequest({
url: server.url, url: server.url,