Skip to content

Commit

Permalink
fix(auth): filtro profesional habilitado en login (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCele authored Sep 25, 2024
1 parent d67741b commit fb0eec6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function createPayload(user, authOrg, prof) {
*/
export async function findTokenData(username: number, organizacion: ObjectId) {
const pAuth = AuthUsers.findOne({ usuario: username, 'organizaciones._id': organizacion });
const pProfesional = Profesional.findOne({ documento: String(username) }, { nombre: true, apellido: true });
const pProfesional = Profesional.findOne({ documento: String(username), habilitado: { $ne: false } }, { nombre: true, apellido: true });
const [auth, prof]: [any, any] = await Promise.all([pAuth, pProfesional]);
if (auth) {
const authOrganizacion = auth.organizaciones.find(item => String(item._id) === String(organizacion));
Expand Down Expand Up @@ -106,7 +106,7 @@ export async function getTokenPayload(token, userData) {

export async function findUser(username) {
const pAuth = AuthUsers.findOne({ usuario: username });
const pProfesional = Profesional.findOne({ documento: username }, { matriculas: true, especialidad: true });
const pProfesional = Profesional.findOne({ documento: username, habilitado: { $ne: false } }, { matriculas: true, especialidad: true });
const [auth, prof] = await Promise.all([pAuth, pProfesional]);
if (auth) {
return {
Expand Down

0 comments on commit fb0eec6

Please sign in to comment.