This commit is contained in:
2020-10-02 11:55:27 -05:00
parent 2a6108d809
commit 3e7907d083
5 changed files with 69 additions and 2 deletions
+4 -1
View File
@@ -5,8 +5,9 @@ const login = (body) => {
return Operador.findOne({ where: { nombre: body.nombre } })
.then((res) => {
if (res) {
if (!bcrypt.compareSync(body.password, res.password))
if (!bcrypt.compareSync(body.password, res.password)) {
throw new Error('El usuario o contraseña son incorrectos.')
}
return { res }
}
throw new Error('El usuario o contraseña son incorrectos.')
@@ -15,3 +16,5 @@ const login = (body) => {
}
module.exports = login
// login({ nombre: 'lemuel', password: 'hola' })