diff --git a/Makefile b/Makefile index 1d64af6..65974ab 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ migrate: ## Migrate database schema init: ## Migrate database schema docker-compose run --rm app yarn run init -.PHONY: watch +.PHONY: watch-frontend watch-frontend: ## Build and watch for changes docker-compose run --rm app yarn run watch diff --git a/package.json b/package.json index f9d990b..d3b04ad 100644 --- a/package.json +++ b/package.json @@ -8,18 +8,18 @@ "node": "^11.6.0" }, "scripts": { - "build": "npm run build-js && npm run build-sass", + "build": "yarn run build-js && yarn run build-sass", "build-js": "webpack --progress -p -c webpack.config.js", "build-sass": "node-sass --include-path ./node_modules/ -r -o web/public/styles/ web/public/styles/", "cover": "istanbul cover _mocha -- -r babel-register test/**/*.spec.js", - "heroku-postbuild": "npm run build", + "heroku-postbuild": "yarn run build", "init": "babel-node -e \"require('./lib/storage').default();\"", "initdb": "node -r babel-register test/initdb.js", "lint": "eslint .", "start": "node -r babel-register app.js", - "test": "npm run test-seed && mocha -r babel-register test/**/*.spec.js", + "test": "yarn run test-seed && mocha -r babel-register test/**/*.spec.js", "test-seed": "babel-node test/fixtures/user.js", - "watch": "concurrently -k -n watch-js,watch-server \"npm run watch-js\" \"npm run watch-server\"", + "watch": "concurrently -k -n watch-js,watch-sass \"yarn run watch-js\" \"yarn run watch-sass\"", "watch-js": "webpack --mode=development --progress -c webpack.config.js", "watch-server": "nodemon -r babel-register -i web/public", "watch-sass": "node-sass --include-path ./node_modules/ -w -r -o web/public/styles/ web/public/styles/" diff --git a/web/lib/auth.js b/web/lib/auth.js index e91767d..3a23d33 100644 --- a/web/lib/auth.js +++ b/web/lib/auth.js @@ -48,6 +48,7 @@ export async function authenticate(email, password) { }); if (user && user.password) { + login.userId = user.id; if (await passwords.verify(password, user.password)) { debug('Password verified'); login.successful = true; @@ -55,7 +56,6 @@ export async function authenticate(email, password) { return user; } debug('Password invalid'); - login.userId = user.id; } await login.save(); return false;