Bcrypt error: illegal arguments String unidentified

后端 未结 8 1987
误落风尘
误落风尘 2021-01-17 10:49

here is my complete code

var express = require(\'express\'),
    app = express(),
    mongoose = require(\'mongoose\'),
    bodyParser = require(\'body-parse         


        
8条回答
  •  北海茫月
    2021-01-17 11:12

    Your code is wrong in this place. You may see it.

    var validPassword = user.comparePassword(req.body.password);
    

    If you use bcryptjs thrid party plugins, like that

    let validPassword = bcrypt.compare(req.body.password, user.password);
    

    bcrypt.compare(password, hashedPassword);

提交回复
热议问题