Skip to content

Commit 438a3eb

Browse files
committed
Se agrega tiempo de activacion para el pacienteApp
1 parent b1f1a7f commit 438a3eb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

modules/mobileApp/auth_routes/autenticacionApp.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,19 @@ router.post('/olvide-password', (req, res, next) => {
8989
return res.status(422).send({ error: 'Se debe ingresar una dirección de e-Mail' });
9090
}
9191
const email = req.body.email.toLowerCase();
92+
const diaHoy = new Date();
93+
9294
return PacienteApp.findOne({ email }, (err, datosUsuario: any) => {
9395
if (err) {
9496
return next(err);
9597
}
9698

97-
if (!datosUsuario) {
99+
if (!datosUsuario || !datosUsuario.activacionApp) {
98100
return res.status(422).send({ error: 'El e-mail ingresado no existe' });
99101
}
100102

101-
if (!datosUsuario.activacionApp) {
102-
return res.status(422).send({ error: 'El e-mail ingresado no existe' });
103+
if (datosUsuario.restablecerPassword?.fechaExpiracion > diaHoy && datosUsuario.restablecerPassword?.codigo) {
104+
return res.status(422).send({ error: 'Ya posee un código de verificación para cambiar su password' });
103105
}
104106

105107
datosUsuario.restablecerPassword.codigo = authController.generarCodigoVerificacion();

utils/roboSender/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function sendEmail(data: IEmail, options: any = {}) {
5555

5656
createdAt: moment().toDate(),
5757
updatedAt: moment().toDate(),
58-
expiredAt: moment().add(1, 'd').toDate(),
58+
expiredAt: moment().add(3, 'd').toDate(),
5959
scheduledAt: options.scheduledAt ? options.scheduledAt : moment().toDate(),
6060
tries: 0,
6161
});

0 commit comments

Comments
 (0)