merge made with feature/gabinete-search branch

This commit is contained in:
Eudes Inácio
2023-07-12 10:30:16 +01:00
1464 changed files with 11496 additions and 187 deletions
+30 -4
View File
@@ -20,6 +20,7 @@ import { PermissionService } from './permission.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { captureException } from '@sentry/angular';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -32,7 +33,7 @@ export class AuthService {
opts:any;
tabIsActive = true
constructor(
private http: HttpClient,
private storageService:StorageService,
@@ -77,9 +78,6 @@ export class AuthService {
async login(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
// Basic peter.maquiran@equilibrium.co.ao:senha123456
// console.log(user.BasicAuthKey)
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
@@ -104,6 +102,34 @@ export class AuthService {
}
async loginContenteProduction(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
}
let response: any;
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/LoginJwt", '', this.opts).toPromise();
console.log('JWT',response)
if(saveSession) {
/* this.SetSession(response, user) */
console.log('teste', response);
CPSession.save(response)
}
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
return response
}
}
// async UpdateLogin() {}
SetSession(response: LoginUserRespose, user:UserForm) {