mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add inactivity page
This commit is contained in:
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { StorageService } from './storage.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { User, UserForm } from '../models/user.model';
|
||||
import { User, UserForm, UserSession } from '../models/user.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpService } from './http.service';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
@@ -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 { SessionStore } from '../store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -37,8 +38,8 @@ export class AuthService {
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
|
||||
if (this.localstoreService.get('user', null) != null) {
|
||||
this.ValidatedUser = this.localstoreService.get('user',{});
|
||||
if (SessionStore.exist) {
|
||||
this.ValidatedUser = SessionStore.user
|
||||
}
|
||||
|
||||
if (localStorage.getItem("userChat") != null) {
|
||||
@@ -63,22 +64,22 @@ export class AuthService {
|
||||
|
||||
try {
|
||||
response = await this.http.post<User>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
const session: UserSession = Object.assign(new UserSession(), response)
|
||||
|
||||
console.log(response);
|
||||
|
||||
if (response) {
|
||||
if( response.RoleID == 100000014) {
|
||||
response.Profile = 'PR'
|
||||
} else if(response.RoleID == 100000011) {
|
||||
response.Profile = 'MDGPR'
|
||||
if( session.RoleID == 100000014) {
|
||||
session.Profile = 'PR'
|
||||
} else if(session.RoleID == 100000011) {
|
||||
session.Profile = 'MDGPR'
|
||||
}
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
session.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
// console.log('response', response)
|
||||
|
||||
this.localstoreService.set('user', response)
|
||||
this.userStore.reset(response)
|
||||
console.log('session', session)
|
||||
|
||||
this.userStore.reset(session)
|
||||
SessionStore.reset(session)
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user