From 7fc97939d6d7d8856cf49b48667ce049dd1a210c Mon Sep 17 00:00:00 2001 From: Bernhard Halbartschlager Date: Sun, 3 May 2020 09:28:01 +0200 Subject: [PATCH 1/2] update dependencies --- package.json | 20 ++++++++++---------- src/controllers/accountController.js | 2 -- src/controllers/aliasController.js | 1 - src/controllers/authenticationController.js | 11 +++++------ src/controllers/domainController.js | 2 -- src/controllers/tlspolicyController.js | 1 - 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index ebbe271..36bdd58 100644 --- a/package.json +++ b/package.json @@ -13,19 +13,19 @@ "author": "Florian Kapfenberger ", "license": "MIT", "dependencies": { + "@hapi/joi": "^17.1.1", "backpack-core": "^0.7.0", - "body-parser": "^1.18.2", - "dotenv": "^6.0.0", - "express": "^4.16.2", - "express-jwt": "^5.3.0", - "express-rate-limit": "^2.11.0", - "helmet": "^3.9.0", - "joi": "^13.0.2", - "jsonwebtoken": "^8.1.0", + "body-parser": "^1.19.0", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "express-jwt": "^5.3.3", + "express-rate-limit": "^5.1.3", + "helmet": "^3.22.0", + "jsonwebtoken": "^8.5.1", "knex": "^0.14.2", - "lodash": "^4.17.4", + "lodash": "^4.17.15", "mariasql": "^0.2.6", - "morgan": "^1.9.0", + "morgan": "^1.10.0", "sha512crypt-node": "^0.1.0" }, "devDependencies": { diff --git a/src/controllers/accountController.js b/src/controllers/accountController.js index 6d73ab4..12ede91 100644 --- a/src/controllers/accountController.js +++ b/src/controllers/accountController.js @@ -1,6 +1,4 @@ -import { isEmpty } from "lodash"; import Account from "../model/account"; - import { isAdmin } from "../helpers/authorizationHelper"; class AccountController { diff --git a/src/controllers/aliasController.js b/src/controllers/aliasController.js index c5e8d56..8cea5dc 100644 --- a/src/controllers/aliasController.js +++ b/src/controllers/aliasController.js @@ -1,6 +1,5 @@ import { isEmpty } from "lodash"; import Alias from "../model/alias"; - import { isAdmin } from "../helpers/authorizationHelper"; class AliasController { diff --git a/src/controllers/authenticationController.js b/src/controllers/authenticationController.js index 438d56e..b127f65 100644 --- a/src/controllers/authenticationController.js +++ b/src/controllers/authenticationController.js @@ -1,12 +1,11 @@ -import Joi from "joi"; -import { promisify } from "util"; - +import Joi from "@hapi/joi"; import Account from "../model/account"; import { generateToken } from "../helpers/tokenHelper"; import { isAdmin } from "../helpers/authorizationHelper"; -const validate = promisify(Joi.validate); -const emailValidator = Joi.string().email(); +const emailValidator = Joi.object({ + email: Joi.string().email() +}); class AuthenticationController { async authenticate(req, res) { @@ -18,7 +17,7 @@ class AuthenticationController { // validate email try { - await validate(email, emailValidator); + await emailValidator.validateAsync({ email }); } catch (validationError) { return res.status(422).json({ message: "invalid email" }); } diff --git a/src/controllers/domainController.js b/src/controllers/domainController.js index 3bfc843..7e065d0 100644 --- a/src/controllers/domainController.js +++ b/src/controllers/domainController.js @@ -1,6 +1,4 @@ -import { isEmpty } from "lodash"; import Domain from "../model/domain"; - import { isAdmin } from "../helpers/authorizationHelper"; class DomainController { diff --git a/src/controllers/tlspolicyController.js b/src/controllers/tlspolicyController.js index 5184686..b9ba538 100644 --- a/src/controllers/tlspolicyController.js +++ b/src/controllers/tlspolicyController.js @@ -1,6 +1,5 @@ import { isEmpty } from "lodash"; import TlsPolicy from "../model/tlspolicy"; - import { isAdmin } from "../helpers/authorizationHelper"; class TlsPolicyController { From 0f40ca2cfba0c4506a535dd0cdaca3db0c2cd87e Mon Sep 17 00:00:00 2001 From: Bernhard Halbartschlager Date: Sun, 3 May 2020 09:58:48 +0200 Subject: [PATCH 2/2] update server dependencies --- .babelrc | 8 +++++--- package.json | 11 +++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.babelrc b/.babelrc index 604a7bc..2b8957b 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,6 @@ { - "presets": ["backpack-core/babel", "react"], - "plugins": ["transform-react-jsx"] -} + "presets": [ + "backpack-core/babel", + "@babel/preset-react" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 36bdd58..d37aa11 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "MIT", "dependencies": { "@hapi/joi": "^17.1.1", - "backpack-core": "^0.7.0", + "backpack-core": "^0.8.4", "body-parser": "^1.19.0", "dotenv": "^8.2.0", "express": "^4.17.1", @@ -29,11 +29,10 @@ "sha512crypt-node": "^0.1.0" }, "devDependencies": { - "babel-plugin-transform-react-jsx": "^6.24.1", - "babel-preset-react": "^6.24.1", - "husky": "^0.14.3", - "lint-staged": "^7.2.0", - "prettier": "^1.9.2" + "@babel/preset-react": "^7.9.4", + "husky": "^4.2.5", + "lint-staged": "^10.2.2", + "prettier": "^2.0.5" }, "lint-staged": { "*.{js,jsx}": [