expressa 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/auth/index.js +9 -7
  2. package/package.json +1 -1
package/auth/index.js CHANGED
@@ -32,13 +32,15 @@ exports.middleware = async function authMiddleware(req, res, next) {
32
32
  } catch (e) {
33
33
  req.uerror = 'user no longer exists'
34
34
  }
35
- if (req.getSetting('jwt_expire_on_password_change') && user.meta.password_last_updated_at !== payload.timestamp) {
36
- req.uerror = 'jwt expired'
37
- }
38
- if (!req.uerror) {
39
- req.uid = payload._id
40
- req.ucollection = payload.collection
41
- req.user = user
35
+ if (user) {
36
+ if (req.getSetting('jwt_expire_on_password_change') && user.meta.password_last_updated_at !== payload.timestamp) {
37
+ req.uerror = 'jwt expired'
38
+ }
39
+ if (!req.uerror) {
40
+ req.uid = payload._id
41
+ req.ucollection = payload.collection
42
+ req.user = user
43
+ }
42
44
  }
43
45
  }
44
46
  next()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expressa",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "API framework using JSON schemas",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/thomas4019/expressa",