login operador final
This commit is contained in:
@@ -15,13 +15,15 @@ const login = async (body) => {
|
||||
);
|
||||
|
||||
return Operador.findOne({
|
||||
where: { operador },
|
||||
where: { operador, activo: true },
|
||||
include: [{ model: TipoUsuario }],
|
||||
}).then((res) => {
|
||||
if (!res) throw new Error('No existe este operador.');
|
||||
if (!res.activo) throw new Error('Este operador no esta activo.');
|
||||
if (comparar(password, res.password)) {
|
||||
delete res.dataValues.password;
|
||||
delete res.dataValues.activo;
|
||||
delete res.dataValues.idTipoUsuario;
|
||||
return {
|
||||
Operador: res,
|
||||
token: crearTokenOperador({
|
||||
|
||||
Reference in New Issue
Block a user