保誠-保戶業務員媒合平台
Tomas
2023-08-14 7521c6641773e25c2ebefeb228fa8733856a849e
PAMapp/shared/services/login.service.ts
@@ -85,23 +85,25 @@
  /** 顧問登入 **/
  logInToConsultant(consultantDto:ConsultantLoginInfo, verificationCode: string):Promise<AxiosResponse<LoginSuccessToken>>{
    // const encryptPassword = AES.encrypt(consultantDto.password, 'PAM KEY').toString();
    const plaintext = "Hello, AES!";
      const key = "PAMKEY1234567890";
      const iv = "0123456789abcdef";
      const keyBytes = CryptoJS.enc.Utf8.parse(key);
      const ivBytes = CryptoJS.enc.Utf8.parse(iv);
      const encrypted = CryptoJS.AES.encrypt(plaintext, keyBytes, {
      const encrypted = CryptoJS.AES.encrypt(consultantDto.password, keyBytes, {
        iv: ivBytes,
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7,
      });
      console.log("Encrypted Text:", encrypted.toString());
    return http.post(`/eService/authenticate/${verificationCode}`, { ...consultantDto, password: encrypted.toString() });
  }
  async logout(): Promise<void> {
    return http.post('/logout');
  }
}
export default new LoginService();