How to use the compare function from bcrypt-nodejs
Find comprehensive JavaScript bcrypt-nodejs.compare code examples handpicked from public code repositorys.
12 13 14 15 16 17 18 19 20 21
} } function retrievePassword(password, hash, callback, async=false) { if(!async) { bcrypt.compare(password, hash, function(err, result) { callback(err, result); }); } else {
4
4
2
GitHub: Indiethon/donation-tracker
289 290 291 292 293 294 295 296 297 298
// API functions. async function login(req, res) { if (req.body.username === undefined || req.body.password === undefined) return res.status(401).send({ error: 'Username or password is incorrect.' }) let user = await database.models['user'].findOne({ username: req.body.username }); if (user === null) return res.status(401).send({ error: 'Username or password is incorrect.' }); bcrypt.compare(req.body.password, user.get('password', null, { getters: false }), (error, match) => { if (match) { let session = uuid(); let token = jwt.sign({ exp: Math.floor(Date.now() / 1000) + 86400000,
0
1
1
+ 2 other calls in file
61 62 63 64 65 66 67 68 69 70
res.status(400).send({ message: "No se encontró el correo", data: undefined }); } else { let user = cliente_arr[0]; bcrypt.compare(data.password, user.password, async function (error, check) { if (check) { if (user.dadoBaja == "false") { res.status(200).send({ data: user,
0
0
1
+ 8 other calls in file
46 47 48 49 50 51 52 53 54 55
res.status(200).send({message: 'No se encontro el correo', data:undefined}); }else{ let user = usuario_arr[0]; bcrypt.compare(data.password, user.password, async function(err, check){ if(check){ res.status(200).send({ data:user, token: jwt.createToken(user)
0
0
1
+ 9 other calls in file
51 52 53 54 55 56 57 58 59 60
// res.status(200).send({ // data: user, // token: jwt.createToken(user) // }); bcrypt.compare(data.password, user.password, async function(error, check){ if(check){ res.status(200).send({ data: user, token: jwt.createToken(user)
0
0
1
+ 5 other calls in file
47 48 49 50 51 52 53 54 55 56
res.status(200).send({message: 'No se encontro el correo', data:undefined}); }else{ //LOGIN let user = admin_arr[0]; bcrypt.compare(data.password, user.password, async function(error,check){ if(check){ res.status(200).send({data:user,token: jwt.createToken(user)}); }else{ res.status(200).send({message: 'La contraseña no coincide', data:undefined});
0
0
1
+ 3 other calls in file
245 246 247 248 249 250 251 252 253 254 255 256
function cryptData(data, callback) { bcrypt.hash(data, null, null, callback); } function compareCryptData(data, hash, callback) { bcrypt.compare(data, hash, callback); } function authorizeUser(userDetails, callbackParent) { const {
0
0
1
34 35 36 37 38 39 40 41 42 43
var usuarios = await Usuario.find({email: data.email}); if(usuarios.length >= 1){ //CORREO EXISTE if(usuarios[0].estado){ bcrypt.compare(data.password, usuarios[0].password, async function(err,check){ if(check){ // res.status(200).send({ token:jwt.createToken(usuarios[0]),
0
0
1
+ 3 other calls in file
30 31 32 33 34 35 36 37 38 39
var clientes = await Cliente.find({email: data.email}); if(clientes.length >= 1){ //CORREO EXISTE if(clientes[0].estado){ bcrypt.compare(data.password, clientes[0].password, async function(err,check){ if(check){ // res.status(200).send({ token:jwt.createToken(clientes[0]),
0
0
1
+ 3 other calls in file
218 219 220 221 222 223 224 225 226 227 228
}); } function comparePasswords(receivedPwd, storedPwd) { return new Promise((resolve, reject) => { true ? bcrypt.compare(receivedPwd, storedPwd, (err, match) => { if(err) reject(err); resolve(match) }) : reject(new Error('HA OCURRIDO UN ERROR EN UNA VALIDACION INTERNA. 10001')) });
0
0
1
+ 3 other calls in file
78 79 80 81 82 83 84 85 86 87
if(res.length < 0) return player.call("showNotification", ["This account doesn`t exist"]); let sqlPassword = res[0]["password"]; bcrypt.compare(loginPass, sqlPassword, function(err, res2) { //Password is incorrect if(res2 === false) return player.call("showNotification", [`Your password is incorrect.`]);
0
0
1
+ 4 other calls in file
GitHub: raddevon/cryptbird
21 22 23 24 25 26 27 28 29 30
}); }); }, compareAsync: function(value, encryptedValue) { return new BluePromise(function(resolve, reject) { bcrypt.compare(value, encryptedValue, function(error, valueMatches) { if (error) { reject(error); } resolve(valueMatches);
0
0
2
+ 3 other calls in file
bcrypt-nodejs.hashSync is the most popular function in bcrypt-nodejs (111 examples)