Михаил, никак. Процессор может работать под нагрузкой 100% десятилетиями. Главное соблюдать температурный режим.
const hash = String(Object.values(users[0]))
app.post('/login', async (req, res) => {
const {
email,
password
} = req.body;
console.log(password)
const [users] = await dbConnection.query(
"SELECT `password` FROM `users` WHERE `email`=?", [email]
)
console.log(users)
if (!email || !password) {
return res.json({
"status": 'error',
"error": "Заполните все поля"
})
}
if (users.length === 0) {
return res.json({
"status": "error",
"error": "Такого аккаунта не существует"
})
}
console.log(JSON.stringify(users, null, 2))
const hash = String(users[0])
console.log(password, hash)
const match = await bcrypt.compare(password, hash);
console.log(match)
if (match) {
return res.json({
"status": "ok",
"location": "/home"
})
} else {
return res.json({
"status": "error",
"error": "Неверный пароль"
})
}
})
String(users[0])
. Результат тот же. И вот что вывел console.log
:[
{
"password": "$2b$10$TQ9En7naeJLulfMbdszrn.Y3HK/p1wn0Ipv7zxa6rMtNxoehyZLe6"
}
]