diff --git a/auth/auth.controller.ts b/auth/auth.controller.ts index 4f920311a6..b7ab8f00f4 100644 --- a/auth/auth.controller.ts +++ b/auth/auth.controller.ts @@ -256,7 +256,7 @@ export async function sendOtpAndNotify(username): Promise { // Se mantiene la validación para usuarios temporales con email if (usuario) { - if (usuario.tipo === 'temporal' && usuario.email) { + if (usuario.tipo === 'temporal' && usuario.authMethod === 'password' && usuario.email) { // Genera un código OTP de 6 dígitos const otpCode = crypto.randomInt(100000, 999999).toString(); @@ -284,10 +284,10 @@ export async function sendOtpAndNotify(username): Promise { attachments: null, }; await sendMail(options); + return usuario; } else { return null; } - return usuario; } else { // El usuario no existe o no es un usuario temporal con email throw { tipo: 'cuentaInexistenteAndes' }; diff --git a/auth/routes/routes.ts b/auth/routes/routes.ts index 169b2d5d84..e0c76b0210 100644 --- a/auth/routes/routes.ts +++ b/auth/routes/routes.ts @@ -269,9 +269,9 @@ router.post('/sendOTPCode', async (req, res, next) => { if (username) { const result = await sendOtpAndNotify(username); if (result) { - return res.json({ status: 'ok' }); + return res.json({ status: 'ok' });// Profesional de Andes } else { - return res.json({ status: 'redirectOneLogin' }); + return res.json({ status: 'redirectOneLogin' });// Profesional de OneLogin } } else { return next(403);