new session service

This commit is contained in:
Peter Maquiran
2023-07-10 12:32:01 +01:00
parent 9676bab7eb
commit f6f61a11ca
13 changed files with 116 additions and 71 deletions
+3 -7
View File
@@ -19,7 +19,7 @@ import { InitialsService } from './functions/initials.service';
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 { DocumentManagementStore } from '../store/documentManagement';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -32,8 +32,6 @@ export class AuthService {
opts:any;
tabIsActive = true
DocumentManagementStore = DocumentManagementStore
constructor(
private http: HttpClient,
@@ -78,9 +76,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,
@@ -119,7 +114,8 @@ export class AuthService {
if(saveSession) {
/* this.SetSession(response, user) */
this.DocumentManagementStore.setData(response)
console.log('teste', response);
CPSession.save(response)
}
} catch (error) {
+2 -2
View File
@@ -882,13 +882,13 @@ export class RoomService {
private async findMessageInDBByData({localReference, _id}) {
const a = await MessageModel.filter({localReference: localReference})
const a = await MessageModel.filter({localReference: localReference}).execute()
if(a.length >= 1) {
return true
}
const c = await MessageModel.filter({_id: _id})
const c = await MessageModel.filter({_id: _id}).execute()
if(c.length >= 1) {
return true
+4 -2
View File
@@ -11,6 +11,7 @@ import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { StorageService } from './storage.service';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -42,14 +43,15 @@ export class ProcessesService {
setHeader() {
console.log('CPSession.AuthorizationJwt', CPSession.AuthorizationJwt);
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
this.headers2 = new HttpHeaders();
this.headers2 = this.headers2.set('Authorization',"bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyNjIiLCJ1bmlxdWVfbmFtZSI6IkdpbHNvbiBNYW51ZWwiLCJlbWFpbCI6ImdpbHNvbi5tYW51ZWxAZ2FiaW5ldGVkaWdpdGFsLmxvY2FsIiwicm9sZSI6IlNlY3JldMOhcmlvIEdlcmFsIiwiZ3JvdXBzaWQiOiJHYWJpbmV0ZSBkZSBUZWNub2xvZ2lhcyBkZSBJbmZvcm1hw6fDo28iLCJvcmdhbmljZW50aXR5aWREIjoiMTA2IiwibmJmIjoxNjg4NTg0NTYzLCJleHAiOjE3MjAxMjA1NjMsImlhdCI6MTY4ODU4NDU2MywiaXNzIjoiOGIxMzBhN2YwLWM3YjctNDdzMjMtOWE4ZC1kNTlhMDE5YWY3NDkiLCJhdWQiOiJkMjh3dzE0NTMtM2M2OC00MWFkLThiNmMtYTUzNDUzODNlMGMyIn0.QDCrQsCH59GQMoudZTHyCMwwHYVwz1mZkLTzvzAwh64"
this.headers2 = this.headers2.set('Authorization',"bearer "+ CPSession.AuthorizationJwt);
);
}
uploadFile(formData:any){