diff --git a/api/routes/authenticate.js b/api/routes/authenticate.js index a0d233f..398cd03 100644 --- a/api/routes/authenticate.js +++ b/api/routes/authenticate.js @@ -29,11 +29,11 @@ authenticate.route('/') res.send(user); } else { // authentication failed - res.status(401).send('Username or password is incorrect'); + res.status(codes.unauthorized).send('Username or password is incorrect'); } }) .catch((err) => { - res.status(400).send(err); + res.status(codes.wrongrequest).send(err); }); }) @@ -47,7 +47,7 @@ let authCheck = (username, password) => { AppUserModel.findOne({username: username}, (err, user) => { if (err) deferred.reject(err.name + ': ' + err.message); - const diff = 60 * 24; // time till expiration [minutes] + const diff = 3 * 60 * 24; // time till expiration [minutes] if (user && bcrypt.compareSync(password, user.password)) { // authentication successful diff --git a/api/routes/http-codes.js b/api/routes/http-codes.js index dbfac5b..8e12bee 100644 --- a/api/routes/http-codes.js +++ b/api/routes/http-codes.js @@ -10,6 +10,7 @@ module.exports = { created: 201, nocontent: 204, wrongrequest: 400, + unauthorized: 401, forbidden: 403, notfound: 404, wrongmethod: 405,