@ahi40/common
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -22,3 +22,3 @@ "use strict"; | ||
var _this = _super.call(this, 'Not Authorized.') || this; | ||
_this.statusCode = 401; | ||
_this.statusCode = 403; | ||
Object.setPrototypeOf(_this, NotAuthorizedError.prototype); | ||
@@ -25,0 +25,0 @@ return _this; |
@@ -22,3 +22,3 @@ "use strict"; | ||
var _this = _super.call(this, 'Token expired.') || this; | ||
_this.statusCode = 401; | ||
_this.statusCode = 402; | ||
Object.setPrototypeOf(_this, TokenExpiredError.prototype); | ||
@@ -25,0 +25,0 @@ return _this; |
@@ -7,6 +7,9 @@ "use strict"; | ||
exports.requireAuth = function (req, res, next) { | ||
console.log('run req auth'); | ||
if (!req.currentUser) { | ||
console.log('no user set'); | ||
throw new not_authorized_error_1.NotAuthorizedError(); | ||
} | ||
if (req.currentUser.exp < Date.now().valueOf() / 1000) { | ||
console.log('token expired'); | ||
throw new token_expired_error_1.TokenExpiredError(); | ||
@@ -13,0 +16,0 @@ } |
{ | ||
"name": "@ahi40/common", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22977
519