refactor res.locals and settings

This commit is contained in:
lesion
2022-02-26 21:27:40 +01:00
parent 9e2ed063b6
commit cf3e1c69fa
20 changed files with 133 additions and 102 deletions

View File

@@ -12,11 +12,11 @@ const oauthServer = new OAuthServer({
debug: true,
requireClientAuthentication: { password: false },
authenticateHandler: {
handle (req) {
if (!req.user) {
handle (req, res) {
if (!res.locals.user) {
throw new Error('Not authenticated!')
}
return req.user
return res.locals.user
}
}
})