From dadb0726b5054bb11fc3ebac9a23bba9c7367f3b Mon Sep 17 00:00:00 2001 From: Francisco Solis <30329003+Im-Fran@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:20:27 -0400 Subject: [PATCH] patch: reparado login de siga MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ocurría un error con contraseñas que incluían ‘&’ entre sus caracteres, con este parche este problema se soluciona. --- src/siga-api/services/auth.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/siga-api/services/auth.service.ts b/src/siga-api/services/auth.service.ts index 9d6c7bd..91b4145 100644 --- a/src/siga-api/services/auth.service.ts +++ b/src/siga-api/services/auth.service.ts @@ -6,7 +6,10 @@ import {HashUtils} from "../../infrastructure/utils/hash.utils"; export class SigaApiAuthService { public static async loginAndGetToken(correo: string, contrasenia: string): Promise { try { - const res = await axios.post(`${process.env.SIGA_API_URL}/autenticacion/login/`, `username=${correo}&password=${contrasenia}`, { + const form = new FormData; + form.set('username', correo); + form.set('password', contrasenia); + const res = await axios.post(`${process.env.SIGA_API_URL}/autenticacion/login/`, form, { headers: { "Content-Type": "application/x-www-form-urlencoded", Host: "siga.utem.cl", @@ -38,7 +41,10 @@ export class SigaApiAuthService { public static async loginAndGetProfile(correo: string, contrasenia: string): Promise { try { - const res = await axios.post(`${process.env.SIGA_API_URL}/autenticacion/login/`, `username=${correo}&password=${contrasenia}`, { + const form = new FormData; + form.set('username', correo); + form.set('password', contrasenia); + const res = await axios.post(`${process.env.SIGA_API_URL}/autenticacion/login/`, form, { headers: { "Content-Type": "application/x-www-form-urlencoded", Host: "siga.utem.cl",