Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export async function sendOtpAndNotify(username): Promise<any> {

// 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();

Expand Down Expand Up @@ -284,10 +284,10 @@ export async function sendOtpAndNotify(username): Promise<any> {
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' };
Expand Down
4 changes: 2 additions & 2 deletions auth/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading