title: bcrypt compareSync always returns false
body: <p>Good day,</p>
  
  <p>I am unable to login as bcrypt compareSync always returns false:</p>
  
  <pre><code>router.post('/authenticate', function(req, res, next){
      User.findOne({username: req.body.username}, function(err, user){
          //handling errors
          if(!bcrypt.compareSync(req.body.password, user.password)){
              return res.status(401).json({
                  success: false,
                  message: 'Invalid login credentials!'
              });
          }
          const token = jwt.sign({user: user}, 'secret', {expiresIn: 7200});
          res.status(200).json({
              success: true,
              message: 'Successfully logged in',
              token: token,
              userId: user._id
          });
      });
  });
  </code></pre>
  
  <p>And here is how i define the user upon account creation:</p>
  
  <pre><code>    var user = new User({
          username: req.body.username,
          password: bcrypt.hashSync(req.body.password, 10),
          email: req.body.email
      });
  </code></pre>
  
  <p>And the error received when trying to login:</p>
  
  <pre><code>Response {_body: "{"success":false,"message":"Invalid login credentials!"}", status: 401, ok: false, statusText: "Unauthorized", headers: Headers, …}
  </code></pre>