User password encrypted

This commit is contained in:
Eudes Inácio
2021-08-26 16:32:59 +01:00
parent 246b626600
commit c80d8fb588
3 changed files with 75 additions and 1 deletions
+3 -1
View File
@@ -12,6 +12,7 @@ import { LocalstoreService } from '../store/localstore.service';
import { ToastService } from './toast.service';
import { UserStore } from 'src/app/store/user.service'
import { SHA1, SHA256, AES, enc } from 'crypto-js'
import { AESEncrypt } from '../services/aesencrypt.service';
@Injectable({
providedIn: 'root'
@@ -33,6 +34,7 @@ export class AuthService {
public alertController: AlertController,
private localstoreService: LocalstoreService,
private toastService: ToastService,
private aesencrypt: AESEncrypt,
) {
this.headers = new HttpHeaders();
@@ -51,7 +53,7 @@ export class AuthService {
async login(user: UserForm): Promise<boolean> {
// user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password);
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
console.log('Basic ' + btoa(user.username + ':' + SHA1(user.password).toString())); //conversão em base64 das credenciais inseridas
console.log('Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ))); //conversão em base64 das credenciais inseridas
this.headers = this.headers.set('Authorization',user.BasicAuthKey);