mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix issues
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserService } from './user.service';
|
||||
|
||||
describe('UserService', () => {
|
||||
let service: UserService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(UserService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
changeProfilePicture(){}
|
||||
|
||||
}
|
||||
@@ -87,7 +87,6 @@ import { LoggingInterceptorService } from './services/logging-interceptor.servic
|
||||
import { PopupQuestionPipe } from './modals/popup-question.pipe';
|
||||
import '@teamhive/capacitor-video-recorder';
|
||||
import { tokenInterceptor } from './interceptors/token.interceptors';
|
||||
import { chatTokenInterceptor } from './interceptors/chatToken.interceptor';
|
||||
|
||||
import { InputFilterDirective } from './services/directives/input-filter.directive';
|
||||
import { VisibilityDirective } from './services/directives/visibility.directive';
|
||||
@@ -253,7 +252,6 @@ registerLocaleData(localePt, 'pt');
|
||||
FFMpeg,
|
||||
FFmpeg,
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
|
||||
chatTokenInterceptor,
|
||||
tokenInterceptor,
|
||||
metricsInterceptor
|
||||
],
|
||||
|
||||
@@ -5,8 +5,19 @@ import { RoomByIdInputDTO, RoomByIdOutputDTO } from "src/app/core/chat/usecase/r
|
||||
import { RoomUpdateInputDTO, RoomUpdateOutputDTO } from "src/app/core/chat/usecase/room/room-update-by-id-use-case.service";
|
||||
import { Result } from "neverthrow";
|
||||
import { AddMemberToRoomInputDTO } from "src/app/core/chat/usecase/member/member-add-use-case.service";
|
||||
import { RoomListOutPutDTO } from "src/app/core/chat/usecase/room/room-get-list-use-case.service";
|
||||
import { RoomListItemOutPutDTO, RoomListItemSchema, RoomListOutPutDTO } from "src/app/core/chat/usecase/room/room-get-list-use-case.service";
|
||||
|
||||
|
||||
export interface ISearchRoom {
|
||||
|
||||
success: boolean,
|
||||
message: any,
|
||||
data: {
|
||||
messages: [],
|
||||
rooms: RoomListItemSchema[]
|
||||
}
|
||||
|
||||
}
|
||||
export abstract class IRoomRemoteRepository {
|
||||
abstract createRoom(data: CreateRoomInputDTO): DataSourceReturn<RoomOutPutDTO>
|
||||
abstract getRoomList(): Promise<DataSourceReturn<RoomListOutPutDTO>>
|
||||
@@ -14,4 +25,5 @@ export abstract class IRoomRemoteRepository {
|
||||
abstract updateRoom(data: RoomUpdateInputDTO): Promise<DataSourceReturn<RoomUpdateOutputDTO>>
|
||||
abstract deleteRoom(id: string): Promise<Result<any ,any>>
|
||||
abstract addMemberToRoomSocket(data: AddMemberToRoomInputDTO): Promise<Result<any ,any>>
|
||||
abstract search(input: string): Promise<Result<RoomListItemOutPutDTO[], any>>
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ const CreatedBySchema = z.object({
|
||||
userPhoto: z.string().nullable()// api check
|
||||
});
|
||||
|
||||
const RoomListItemOutPutDTOSchema = z.object({
|
||||
chatRoom: z.object({
|
||||
const roomListItemSchema = z.object({
|
||||
id: z.string(),
|
||||
roomName: z.string(),
|
||||
createdBy: CreatedBySchema,
|
||||
@@ -30,7 +29,10 @@ const RoomListItemOutPutDTOSchema = z.object({
|
||||
messages: MessageEntitySchema.array(),
|
||||
user1: CreatedBySchema.nullable(),
|
||||
user2: CreatedBySchema.nullable()
|
||||
}),
|
||||
})
|
||||
|
||||
const RoomListItemOutPutDTOSchema = z.object({
|
||||
chatRoom: roomListItemSchema,
|
||||
joinAt: z.string()
|
||||
})
|
||||
|
||||
@@ -43,7 +45,7 @@ export const RoomListOutPutDTOSchema = z.object({
|
||||
});
|
||||
|
||||
export type RoomListItemOutPutDTO = z.infer<typeof RoomListItemOutPutDTOSchema>
|
||||
|
||||
export type RoomListItemSchema = z.infer< typeof roomListItemSchema>
|
||||
export type RoomListOutPutDTO = z.infer<typeof RoomListOutPutDTOSchema>
|
||||
|
||||
|
||||
@@ -60,7 +62,6 @@ export class GetRoomListUseCaseService {
|
||||
|
||||
@captureAndReraiseAsync('RoomRepositoryService/list')
|
||||
async execute() {
|
||||
// console.log('update===============')
|
||||
const result = await this.roomRemoteDataSourceService.getRoomList()
|
||||
|
||||
const localList = await this.roomLocalDataSourceService.findAll()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { IRoomRemoteRepository } from '../../repository/room/room-remote-repository';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RoomSearchByNameService {
|
||||
|
||||
constructor(
|
||||
private roomRemoteDataSourceService: IRoomRemoteRepository
|
||||
) { }
|
||||
|
||||
async execute(name: string) {
|
||||
const result = this.roomRemoteDataSourceService.search(name)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -37,10 +37,22 @@ const LoginUserResponseSchema = z.object({
|
||||
});
|
||||
|
||||
|
||||
|
||||
export type UserLoginOutputResponse = z.infer<typeof LoginUserResponseSchema>
|
||||
|
||||
const UserRefreshTokenInputSchema = z.object({
|
||||
authorization: z.string(),
|
||||
refreshToken: z.string(),
|
||||
channelId: z.number()
|
||||
})
|
||||
|
||||
export type UserRefreshTokenInputDTO = z.infer<typeof UserRefreshTokenInputSchema>
|
||||
|
||||
|
||||
|
||||
export type IUserRepositoryLoginParams = z.infer<typeof UserRepositoryLoginParams>
|
||||
export abstract class IUserRemoteRepository {
|
||||
abstract login(input: IUserRepositoryLoginParams): Promise<Result<HttpResult<UserLoginOutputResponse>, HttpErrorResponse>>
|
||||
abstract logout(): Promise<Result<HttpResult<any>, HttpErrorResponse>>
|
||||
abstract refreshToken(input:UserRefreshTokenInputDTO): Promise<Result<HttpResult<any>, HttpErrorResponse>>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { z } from 'zod';
|
||||
import { z, ZodError, ZodSchema } from 'zod';
|
||||
import { IUserRemoteRepository } from '../repository/user-remote-repository';
|
||||
import { XTracerAsync, TracingType } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { zodSafeValidation } from 'src/app/utils/zodValidation';
|
||||
@@ -8,6 +8,8 @@ import { AESEncrypt } from 'src/app/services/aesencrypt.service';
|
||||
import { UserLoginMapper } from '../mapper/user-login';
|
||||
import { UserSession } from 'src/app/models/user.model';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { err, ok, Result } from 'neverthrow';
|
||||
import { error } from '../../../services/Either/index';
|
||||
|
||||
const UserLoginInputSchema = z.object({
|
||||
username: z.string(),
|
||||
@@ -36,6 +38,11 @@ const UserLoginOutputSchema = z.object({
|
||||
|
||||
export type UserLoginOutput = z.infer<typeof UserLoginOutputSchema>
|
||||
|
||||
export enum LoginError {
|
||||
userNotFound = 401,
|
||||
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -48,13 +55,13 @@ export class UserLoginUseCaseService {
|
||||
) { }
|
||||
|
||||
@XTracerAsync({name:'UserLoginUseCaseService', module:'user', bugPrint: true})
|
||||
async execute(input: UserLoginInput, tracing?: TracingType) {
|
||||
async execute(input: UserLoginInput, tracing?: TracingType): Promise<Result<UserLoginOutput, LoginError | ZodError<UserLoginInput>>> {
|
||||
const validation = zodSafeValidation<UserLoginInput>(UserLoginInputSchema, input)
|
||||
|
||||
if(validation.isOk()) {
|
||||
|
||||
let channelId;
|
||||
if ( this.platform.is('desktop') || this.platform.is("mobileweb")){
|
||||
if ( this.platform.is('desktop') || this.platform.is("mobileweb")) {
|
||||
channelId = 2
|
||||
} else {
|
||||
channelId = 1
|
||||
@@ -67,28 +74,21 @@ export class UserLoginUseCaseService {
|
||||
ChannelId: channelId
|
||||
})
|
||||
|
||||
return result.map(e => {
|
||||
if(result.isOk() && result.value.data.data) {
|
||||
|
||||
const data = UserLoginMapper.toDomainData(e.data)
|
||||
const data = UserLoginMapper.toDomainData(result.value.data);
|
||||
const session: UserSession = Object.assign(SessionStore.user, data);
|
||||
SessionStore.reset(session);
|
||||
|
||||
const session: UserSession = Object.assign(SessionStore.user, data)
|
||||
return ok(data)
|
||||
|
||||
if (session.RoleID == 100000014) {
|
||||
session.Profile = 'PR'
|
||||
} else if (session.RoleID == 100000011) {
|
||||
session.Profile = 'MDGPR'
|
||||
} else if (session.RoleID == 99999872) {
|
||||
session.Profile = 'Consultant'
|
||||
} else if (session.RoleID == 99999886) {
|
||||
session.Profile = 'SGGPR'
|
||||
} else {
|
||||
session.Profile = 'Unknown'
|
||||
} else if (result.isOk() && !result.value.data.data) {
|
||||
return err(LoginError.userNotFound)
|
||||
}
|
||||
|
||||
SessionStore.reset(session)
|
||||
|
||||
return UserLoginMapper.toDomainData(e.data)
|
||||
})
|
||||
if(result.isErr() && result.error.status) {
|
||||
return err(result.error.status as LoginError)
|
||||
}
|
||||
|
||||
} else {
|
||||
tracing.setAttribute('parameter error','true')
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { z } from 'zod';
|
||||
import { IUserRemoteRepository } from '../repository/user-remote-repository';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserRefreshTokenService {
|
||||
|
||||
constructor(
|
||||
private userRemoteRepository: IUserRemoteRepository,
|
||||
private platform: Platform
|
||||
) { }
|
||||
|
||||
@XTracerAsync({name:'UserRefreshTokenService', module:'user', bugPrint: true})
|
||||
async execute() {
|
||||
let channelId;
|
||||
if ( this.platform.is('desktop') || this.platform.is("mobileweb")){
|
||||
channelId = 2
|
||||
} else {
|
||||
channelId = 1
|
||||
}
|
||||
|
||||
return await this.userRemoteRepository.refreshToken({
|
||||
authorization: SessionStore.user.Authorization,
|
||||
refreshToken: SessionStore.user.RefreshToken,
|
||||
channelId
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,17 @@ import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Rout
|
||||
import { Observable } from 'rxjs';
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { RouteService } from 'src/app/services/route.service'
|
||||
import { FirstEnterService } from 'src/app/services/first-enter.service'
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthGuard implements CanActivate {
|
||||
|
||||
constructor(
|
||||
private router:Router,
|
||||
public p: PermissionService,
|
||||
){}
|
||||
) {}
|
||||
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
|
||||
@@ -14,7 +14,7 @@ import { DexieUserPhotoTable, UserPhotoTable, UserPhotoTableColumn } from './sch
|
||||
|
||||
|
||||
// Database declaration (move this to its own module also)
|
||||
export const chatDatabase = new Dexie('chat-database-v3',{
|
||||
export const chatDatabase = new Dexie('chat-database-v4',{
|
||||
// indexedDB: new FDBFactory,
|
||||
// IDBKeyRange: FDBKeyRange, // Mocking IDBKeyRange
|
||||
}) as Dexie & {
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
HttpInterceptor,
|
||||
HttpRequest,
|
||||
HttpHandler,
|
||||
HttpEvent,
|
||||
HttpErrorResponse,
|
||||
HTTP_INTERCEPTORS,
|
||||
HttpHeaders,
|
||||
} from '@angular/common/http';
|
||||
import { Observable, throwError, BehaviorSubject } from 'rxjs';
|
||||
import { catchError, switchMap, filter, take } from 'rxjs/operators';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
|
||||
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
|
||||
@Injectable()
|
||||
export class ChatTokenInterceptor implements HttpInterceptor {
|
||||
private isRefreshing = false;
|
||||
headers: HttpHeaders;
|
||||
options: any;
|
||||
private refreshChatTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(
|
||||
null
|
||||
);
|
||||
|
||||
private excludedDomains = ['Login',environment.apiURL, 'http://localhost:8019'];// Add other domains as needed
|
||||
|
||||
constructor(private http: HttpClient, private router: Router, private p: PermissionService, private NetworkServiceService: NetworkServiceService) { }
|
||||
|
||||
intercept(
|
||||
request: HttpRequest<any>,
|
||||
next: HttpHandler
|
||||
): Observable<HttpEvent<any>> {
|
||||
if (this.shouldExcludeDomain(request)) {
|
||||
return next.handle(request);
|
||||
}
|
||||
|
||||
if (SessionStore.user.Authorization) {
|
||||
request = this.addToken(request, SessionStore.user.Authorization);
|
||||
}
|
||||
|
||||
return next.handle(request).pipe(
|
||||
catchError((error) => {
|
||||
if (error instanceof HttpErrorResponse && error.status === 401) {
|
||||
return this.handle401Error(request, next);
|
||||
} else {
|
||||
return throwError(error);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private shouldExcludeDomain(request: HttpRequest<any>): boolean {
|
||||
const url = request.url.toLowerCase();
|
||||
return this.excludedDomains.some((domain) => url.includes(domain.toLowerCase()));
|
||||
}
|
||||
|
||||
private handle401Error(
|
||||
request: HttpRequest<any>,
|
||||
next: HttpHandler
|
||||
): Observable<HttpEvent<any>> {
|
||||
if (!this.isRefreshing) {
|
||||
this.isRefreshing = true;
|
||||
this.refreshChatTokenSubject.next(null);
|
||||
|
||||
return this.refreshToken().pipe(
|
||||
switchMap((token: any) => {
|
||||
this.isRefreshing = false;
|
||||
|
||||
let data = {
|
||||
status: token['status'],
|
||||
data: {
|
||||
userId: token['data'].userId,
|
||||
authToken: token['data'].authToken
|
||||
}
|
||||
}
|
||||
//SessionStore.user.ChatData = data
|
||||
SessionStore.save()
|
||||
/* this.setheader() */
|
||||
|
||||
|
||||
|
||||
this.refreshChatTokenSubject.next(token.Authorization);
|
||||
return next.handle(this.addToken(request, token.Authorization));
|
||||
})
|
||||
);
|
||||
} else {
|
||||
return this.refreshChatTokenSubject.pipe(
|
||||
filter((token) => token != null),
|
||||
take(1),
|
||||
switchMap((jwt) => {
|
||||
return next.handle(this.addToken(request, jwt));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private addToken(request: HttpRequest<any>, token: string) {
|
||||
let headers = new HttpHeaders();
|
||||
|
||||
try {
|
||||
|
||||
//headers = headers.set('X-User-Id', SessionStore?.user?.ChatData?.data?.userId);
|
||||
//headers = headers.set('X-Auth-Token', SessionStore?.user?.ChatData?.data.authToken);
|
||||
|
||||
return request.clone({
|
||||
setHeaders: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
...headers.keys().reduce((acc, key) => ({ ...acc, [key]: headers.get(key) }), {}),
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
|
||||
return request.clone({
|
||||
setHeaders: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/* private addToken(request: HttpRequest<any>, token: string) {
|
||||
return request.clone({
|
||||
setHeaders: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
} */
|
||||
|
||||
private refreshToken(): Observable<any> {
|
||||
return this.http
|
||||
.get<any>(environment.apiURL + 'UserAuthentication/RegenereChatToken', {
|
||||
/* refreshToken: SessionStore.user.RefreshToken, */
|
||||
})
|
||||
.pipe(
|
||||
catchError((error) => {
|
||||
// Handle token refresh failure
|
||||
console.log('ChatToken refresh failed:', error);
|
||||
return throwError(error);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
setheader() {
|
||||
try {
|
||||
|
||||
// if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) {
|
||||
// this.headers = new HttpHeaders();;
|
||||
|
||||
// if (this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
// //
|
||||
// //this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId);
|
||||
// //this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
|
||||
// this.options = {
|
||||
// headers: this.headers,
|
||||
// };
|
||||
|
||||
// }
|
||||
// }
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const chatTokenInterceptor = {
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: ChatTokenInterceptor,
|
||||
multi: true
|
||||
};
|
||||
@@ -14,6 +14,10 @@ import { SessionStore } from '../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { Router } from "@angular/router";
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { UserLoginOutputResponse } from "../core/user/repository/user-remote-repository";
|
||||
import { UserLoginMapper } from "../core/user/mapper/user-login";
|
||||
import { UserSession } from "../models/user.model";
|
||||
|
||||
@Injectable()
|
||||
export class TokenInterceptor implements HttpInterceptor {
|
||||
@@ -24,7 +28,11 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
|
||||
private excludedDomains = [ 'Login', environment.apiChatUrl, 'http://localhost:8019']; // Add the domains you want to exclude
|
||||
|
||||
constructor(private http: HttpClient, private router: Router,private httpErrorHandle: HttpErrorHandle,) { }
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private router: Router,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private platform: Platform) { }
|
||||
|
||||
|
||||
intercept(
|
||||
@@ -44,7 +52,11 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
|
||||
catchError((error) => {
|
||||
console.log('interceptor ',error)
|
||||
if (error instanceof HttpErrorResponse && error.status === 401) {
|
||||
if(error.url.includes('/Users/RefreshToken') && error.status === 401) {
|
||||
console.log("refresh token error11",error)
|
||||
return throwError(error);
|
||||
}
|
||||
else if (error instanceof HttpErrorResponse && error.status === 401) {
|
||||
return this.handle401Error(request, next);
|
||||
} else if (error.url.includes('https://gdapi-dev.dyndns.info/stage/api/v2') && error.status === 0){
|
||||
return this.handle401Error(request, next);
|
||||
@@ -78,10 +90,10 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
this.refreshTokenSubject.next(null);
|
||||
|
||||
return this.refreshToken().pipe(
|
||||
switchMap((token: any) => {
|
||||
switchMap((data: UserLoginOutputResponse) => {
|
||||
this.isRefreshing = false;
|
||||
this.refreshTokenSubject.next(token.Authorization);
|
||||
return next.handle(this.addToken(request, token.Authorization));
|
||||
this.refreshTokenSubject.next(data?.data?.authorization);
|
||||
return next.handle(this.addToken(request, data?.data?.authorization));
|
||||
})
|
||||
);
|
||||
} else {
|
||||
@@ -99,23 +111,33 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
|
||||
//this method refresh token is declared here temporary beacouse a circular error
|
||||
refreshToken() {
|
||||
let channelId;
|
||||
if ( this.platform.is('desktop') || this.platform.is("mobileweb")){
|
||||
channelId = 2
|
||||
} else {
|
||||
channelId = 1
|
||||
}
|
||||
|
||||
return this.http
|
||||
.put<any>(environment.apiURL + "UserAuthentication/RefreshToken", {
|
||||
.post<UserLoginOutputResponse>('https://gdapi-dev.dyndns.info/stage/api/v2/Users/RefreshToken', {
|
||||
authorization: SessionStore.user.Authorization,
|
||||
refreshToken: SessionStore.user.RefreshToken,
|
||||
channelId
|
||||
},)
|
||||
.pipe(
|
||||
tap((tokens) => {
|
||||
console.log(tokens)
|
||||
SessionStore.user.Authorization = tokens.Authorization;
|
||||
SessionStore.user.RefreshToken = tokens.refreshToken;
|
||||
SessionStore.save();
|
||||
tap((data) => {
|
||||
|
||||
SessionStore.user.Authorization = data.data.authorization;
|
||||
SessionStore.user.RefreshToken = data.data.refreshToken;
|
||||
//const userData = UserLoginMapper.toDomainData(data)
|
||||
//const session: UserSession = Object.assign(SessionStore.user, userData)
|
||||
//SessionStore.reset(session)ta
|
||||
|
||||
}),
|
||||
catchError((error) => {
|
||||
console.log(error)
|
||||
SessionStore.user.Authorization = SessionStore.user.Authorization;
|
||||
SessionStore.user.RefreshToken = SessionStore.user.RefreshToken;
|
||||
console.log("refresh token error",error)
|
||||
// SessionStore.user.Authorization = SessionStore.user.Authorization;
|
||||
// SessionStore.user.RefreshToken = SessionStore.user.RefreshToken;
|
||||
SessionStore.setInativity(false)
|
||||
/* SessionStore.setUrlBeforeInactivity(this.router.url); */
|
||||
|
||||
|
||||
@@ -311,7 +311,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -337,7 +338,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: { a: 1}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -362,7 +364,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -395,7 +398,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -425,7 +429,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
/* if (this.postData.DispatchFolder.Message) { */
|
||||
@@ -456,7 +461,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -488,7 +494,8 @@ export class CreateProcessPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -7,13 +7,16 @@ import { IonicModule } from '@ionic/angular';
|
||||
import { ProfilePageRoutingModule } from './profile-routing.module';
|
||||
|
||||
import { ProfilePage } from './profile.page';
|
||||
import { UserModule } from 'src/app/module/user/user.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
ProfilePageRoutingModule
|
||||
ProfilePageRoutingModule,
|
||||
//
|
||||
UserModule
|
||||
],
|
||||
declarations: [ProfilePage]
|
||||
})
|
||||
|
||||
@@ -15,4 +15,5 @@ export class Despacho{
|
||||
SourceId: string
|
||||
}[],
|
||||
}
|
||||
dataFields: Object
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { SignalRService } from 'src/app/infra/socket/signalR/signal-r.service';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { CreateRoomInputDTO, RoomOutPutDTO } from '../../../../../core/chat/usecase/room/room-create-use-case.service';
|
||||
import { IRoomRemoteRepository } from 'src/app/core/chat/repository/room/room-remote-repository';
|
||||
import { IRoomRemoteRepository, ISearchRoom } from 'src/app/core/chat/repository/room/room-remote-repository';
|
||||
import { RoomByIdOutputDTO } from 'src/app/core/chat/usecase/room/room-get-by-id-use-case.service';
|
||||
import { RoomUpdateInputDTO, RoomUpdateOutputDTO } from 'src/app/core/chat/usecase/room/room-update-by-id-use-case.service';
|
||||
import { RoomListOutPutDTO } from '../../../../../core/chat/usecase/room/room-get-list-use-case.service';
|
||||
import { RoomListItemOutPutDTO, RoomListItemSchema, RoomListOutPutDTO } from '../../../../../core/chat/usecase/room/room-get-list-use-case.service';
|
||||
import { z } from 'zod';
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter';
|
||||
import { AddMemberToRoomInputDTO } from 'src/app/core/chat/usecase/member/member-add-use-case.service';
|
||||
@@ -54,6 +54,13 @@ export class RoomRemoteDataSourceService implements IRoomRemoteRepository {
|
||||
return result.map((e)=> e.data)
|
||||
}
|
||||
|
||||
|
||||
async search(input: string): Promise<Result<RoomListItemOutPutDTO[], any>> {
|
||||
const result = await this.Http.get<ISearchRoom>(`${this.baseUrl}/search?value=${input}`);
|
||||
|
||||
return result.map((e)=> ( e.data.data.rooms.map(j => ({ chatRoom: j, joinAt: ''})) ))
|
||||
}
|
||||
|
||||
//@ValidateSchema(RoomUpdateInputDTOSchema)
|
||||
//@APIReturn(RoomByIdOutputDTOSchema,'update/Room/${id}')
|
||||
async updateRoom(data: RoomUpdateInputDTO): Promise<DataSourceReturn<RoomUpdateOutputDTO>> {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { IProfilePictureInputDTO } from '../dto/profilePictureInputDTO';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { TracingType } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter';
|
||||
import { IUserRepositoryLoginParams } from 'src/app/core/user/repository/user-remote-repository';
|
||||
import { IUserRepositoryLoginParams, UserRefreshTokenInputDTO } from 'src/app/core/user/repository/user-remote-repository';
|
||||
import { UserLoginOutput } from 'src/app/core/user/use-case/user-login-use-case.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
@Injectable({
|
||||
@@ -33,6 +33,11 @@ export class UserRemoteRepositoryService {
|
||||
return await this.http.post<UserLoginOutput>(`${this.baseUrl}/Users/${SessionStore.user.UserId}/logout`, {})
|
||||
}
|
||||
|
||||
async refreshToken(input: UserRefreshTokenInputDTO) {
|
||||
|
||||
return await this.http.post<UserLoginOutput>(`${this.baseUrl}/Users/RefreshToken`, input)
|
||||
}
|
||||
|
||||
getUserProfilePhoto(guid: string, tracing?: TracingType) {
|
||||
const geturl = environment.apiURL + 'UserAuthentication/GetPhoto';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { UserLoginInput, UserLoginUseCaseService } from 'src/app/core/user/use-c
|
||||
import { UserLogOutUseCaseService } from 'src/app/core/user/use-case/user-log-out-use-case.service';
|
||||
import { SessionStore } from './service/session.service'
|
||||
import { UserEntity } from 'src/app/core/user/entity/userEntity';
|
||||
import { UserRefreshTokenService } from 'src/app/core/user/use-case/user-refresh-token.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -11,7 +12,8 @@ export class UserService {
|
||||
|
||||
constructor(
|
||||
private userLoginUseCaseService: UserLoginUseCaseService,
|
||||
private userLogOutUseCaseService: UserLogOutUseCaseService
|
||||
private userLogOutUseCaseService: UserLogOutUseCaseService,
|
||||
private userRefreshTokenService: UserRefreshTokenService
|
||||
) { }
|
||||
|
||||
|
||||
@@ -29,4 +31,8 @@ export class UserService {
|
||||
async logout() {
|
||||
return await this.userLogOutUseCaseService.execute()
|
||||
}
|
||||
|
||||
refreshToken() {
|
||||
return this.userRefreshTokenService.execute()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@ import { HttpModule } from 'src/app/infra/http/http.module';
|
||||
import { IUserRemoteRepository } from 'src/app/core/user/repository/user-remote-repository';
|
||||
import { UserRemoteRepositoryService } from './data/datasource/user-remote-repository.service';
|
||||
import { UserService } from './domain/user.service'
|
||||
|
||||
import { UserLoginUseCaseService } from 'src/app/core/user/use-case/user-login-use-case.service';
|
||||
import { UserLogOutUseCaseService } from 'src/app/core/user/use-case/user-log-out-use-case.service';
|
||||
import { UserRefreshTokenService } from 'src/app/core/user/use-case/user-refresh-token.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [HttpModule],
|
||||
providers: [
|
||||
@@ -10,18 +15,19 @@ import { UserService } from './domain/user.service'
|
||||
provide: IUserRemoteRepository,
|
||||
useClass: UserRemoteRepositoryService, // or MockDataService
|
||||
},
|
||||
|
||||
// domain service
|
||||
UserService,
|
||||
// use case
|
||||
UserLoginUseCaseService,
|
||||
UserLogOutUseCaseService,
|
||||
UserRefreshTokenService
|
||||
],
|
||||
declarations: [],
|
||||
schemas: [],
|
||||
entryComponents: [
|
||||
|
||||
]
|
||||
],
|
||||
})
|
||||
export class UserModule {
|
||||
|
||||
constructor(
|
||||
private UserService:UserService
|
||||
) {}
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
+8
-3
@@ -371,6 +371,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
let action_despacho = {
|
||||
@@ -405,7 +406,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
let action_parecer = {
|
||||
@@ -437,7 +439,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
//
|
||||
let action_deferimento = {
|
||||
@@ -475,6 +478,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +523,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
AttachmentList: docs,
|
||||
dataFields: {}
|
||||
}
|
||||
|
||||
let action_parecer_pr = {
|
||||
|
||||
@@ -150,10 +150,12 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- {{ segmentVista }}: segmentVista -->
|
||||
<div #scroll [ngSwitch]="segmentVista" class="overflow-y-auto">
|
||||
<!-- This is the list view -->
|
||||
<div *ngSwitchCase="'listview'">
|
||||
|
||||
{{ TaskService.loadCount}}: TaskService.loadCount
|
||||
|
||||
<ion-item-sliding *ngIf="TaskService.loadCount || (AllProcess.length >= 1 && TaskService.loadNum >= 1)">
|
||||
<div class="listview">
|
||||
|
||||
@@ -461,8 +461,11 @@ export class GabineteDigitalPage implements OnInit {
|
||||
async loadAllProcesses() {
|
||||
|
||||
this.skeletonLoader = true
|
||||
try {
|
||||
|
||||
await this.TaskService.LoadTask();
|
||||
this.dynamicSearch();
|
||||
} catch (e) {}
|
||||
this.skeletonLoader = false
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ import { UserModule } from 'src/app/module/user/user.module';
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
LoginPageRoutingModule
|
||||
LoginPageRoutingModule,
|
||||
UserModule
|
||||
],
|
||||
declarations: [
|
||||
LoginPage
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { UserForm } from 'src/app/models/user.model';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
@@ -22,6 +21,8 @@ import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.serv
|
||||
import { RoomLocalRepository } from 'src/app/module/chat/data/repository/room/room-local-repository.service'
|
||||
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service'
|
||||
import { UserService } from 'src/app/module/user/domain/user.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { LoginError } from 'src/app/core/user/use-case/user-login-use-case.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -47,14 +48,12 @@ export class LoginPage implements OnInit {
|
||||
constructor(
|
||||
private notificatinsservice: NotificationsService,
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private toastService: ToastService,
|
||||
public alertController: AlertController,
|
||||
private clearStoreService: ClearStoreService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private platform: Platform,
|
||||
private storage: Storage,
|
||||
private storageService: StorageService,
|
||||
@@ -64,7 +63,8 @@ export class LoginPage implements OnInit {
|
||||
private ChatServiceService: ChatServiceService,
|
||||
private RoomLocalRepository: RoomLocalRepository,
|
||||
private MessageLocalDataSourceService: MessageLocalDataSourceService,
|
||||
private UserService:UserService
|
||||
private UserService:UserService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
) { }
|
||||
|
||||
ngOnInit() { }
|
||||
@@ -209,10 +209,11 @@ export class LoginPage implements OnInit {
|
||||
SessionStore.hasPassLogin = true;
|
||||
|
||||
}
|
||||
}/*
|
||||
else{
|
||||
this.toastService._badRequest('Ocorreu um problema por favor valide o username e password');
|
||||
} */
|
||||
} else {
|
||||
if( typeof attempt.error == 'number') {
|
||||
this.httpErroHandle.httpStatusHandle({ status: attempt.error as LoginError})
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService._badRequest('Por favor, insira a sua palavra-passe');
|
||||
@@ -234,7 +235,7 @@ export class LoginPage implements OnInit {
|
||||
//When user has got access to Agenda but does not have their own calendar, goes to Agenda
|
||||
//if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore?.user?.OwnerCalendars.length == 0) {
|
||||
if (this.p.userPermission(this.p.permissionList.Agenda.access)) {
|
||||
this.router.navigate(['/home/agenda']);
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
else {
|
||||
this.router.navigate(['/home/events']);
|
||||
|
||||
@@ -91,34 +91,34 @@ export class AuthService {
|
||||
|
||||
}
|
||||
|
||||
async loginContenteProduction(user: UserForm, { saveSession = true }): Promise<UserSession> {
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password, user.username));
|
||||
// async loginContenteProduction(user: UserForm, { saveSession = true }): Promise<UserSession> {
|
||||
// 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,
|
||||
}
|
||||
// this.headers = this.headers.set('Authorization', user.BasicAuthKey);
|
||||
// this.opts = {
|
||||
// headers: this.headers,
|
||||
// }
|
||||
|
||||
let response: any;
|
||||
// let response: any;
|
||||
|
||||
try {
|
||||
response = await this.http.post<UserSession>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
console.log('JWT', response)
|
||||
// try {
|
||||
// response = await this.http.post<UserSession>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
// console.log('JWT', response)
|
||||
|
||||
if (saveSession) {
|
||||
/* this.SetSession(response, user) */
|
||||
console.log('teste', response);
|
||||
// if (saveSession) {
|
||||
// /* this.SetSession(response, user) */
|
||||
// console.log('teste', response);
|
||||
|
||||
return response
|
||||
// return response
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
return response
|
||||
}
|
||||
// }
|
||||
// } catch (error) {
|
||||
// this.httpErroHandle.httpStatusHandle(error)
|
||||
// } finally {
|
||||
// return response
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// async UpdateLogin() {}
|
||||
|
||||
@@ -152,50 +152,50 @@ export class AuthService {
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
async logoutUser() {
|
||||
// async logoutUser() {
|
||||
|
||||
this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
|
||||
// this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
|
||||
|
||||
this.opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
// this.opts = {
|
||||
// headers: this.headers,
|
||||
// }
|
||||
|
||||
let response: any;
|
||||
try {
|
||||
response = await this.http.delete<UserSession>(environment.apiURL + "userauthentication/Logout", this.opts).toPromise();
|
||||
SessionStore.user.Authorization = "";
|
||||
SessionStore.user.RefreshToken = "";
|
||||
} catch (error) {
|
||||
this.errorHandler.handleError(error);
|
||||
this.httpErroHandle.loginHttpStatusHandle(error)
|
||||
captureException(error);
|
||||
// let response: any;
|
||||
// try {
|
||||
// response = await this.http.delete<UserSession>(environment.apiURL + "userauthentication/Logout", this.opts).toPromise();
|
||||
// SessionStore.user.Authorization = "";
|
||||
// SessionStore.user.RefreshToken = "";
|
||||
// } catch (error) {
|
||||
// this.errorHandler.handleError(error);
|
||||
// this.httpErroHandle.loginHttpStatusHandle(error)
|
||||
// captureException(error);
|
||||
|
||||
if(error?.status == 403) {
|
||||
console.log('error?.status == 403')
|
||||
}
|
||||
// if(error?.status == 403) {
|
||||
// console.log('error?.status == 403')
|
||||
// }
|
||||
|
||||
} finally {
|
||||
return response
|
||||
}
|
||||
}
|
||||
// } finally {
|
||||
// return response
|
||||
// }
|
||||
// }
|
||||
|
||||
refreshToken() {
|
||||
// refreshToken() {
|
||||
|
||||
return this.http
|
||||
.put<any>(environment.apiURL + "UserAuthentication/RefreshToken", {
|
||||
refreshToken: SessionStore.user.RefreshToken,
|
||||
},)
|
||||
.pipe(
|
||||
tap((tokens) => {
|
||||
console.log(tokens)
|
||||
SessionStore.user.Authorization = tokens.Authorization;
|
||||
SessionStore.user.RefreshToken = tokens.refreshToken;
|
||||
// return this.http
|
||||
// .put<any>(environment.apiURL + "UserAuthentication/RefreshToken", {
|
||||
// refreshToken: SessionStore.user.RefreshToken,
|
||||
// },)
|
||||
// .pipe(
|
||||
// tap((tokens) => {
|
||||
// console.log(tokens)
|
||||
// SessionStore.user.Authorization = tokens.Authorization;
|
||||
// SessionStore.user.RefreshToken = tokens.refreshToken;
|
||||
|
||||
}),
|
||||
catchError((error) => {
|
||||
this.logoutUser();
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
}
|
||||
// }),
|
||||
// catchError((error) => {
|
||||
// this.logoutUser();
|
||||
// return of(false);
|
||||
// })
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ export class ProcessesService {
|
||||
|
||||
authheader = {};
|
||||
loggeduser: UserSession;
|
||||
headers: HttpHeaders;
|
||||
headers2: HttpHeaders;
|
||||
|
||||
|
||||
|
||||
@@ -40,17 +38,7 @@ export class ProcessesService {
|
||||
}
|
||||
|
||||
|
||||
setHeader() {
|
||||
|
||||
|
||||
this.headers = new HttpHeaders();;
|
||||
|
||||
this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
|
||||
|
||||
this.headers2 = new HttpHeaders();;
|
||||
|
||||
this.headers2 = this.headers2.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
|
||||
}
|
||||
setHeader() {}
|
||||
|
||||
uploadFile(formData: any) {
|
||||
|
||||
@@ -58,7 +46,6 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'lakefs/UploadFiles';
|
||||
|
||||
let options = {
|
||||
headers: this.headers
|
||||
};
|
||||
|
||||
return this.http.post(`${geturl}`, formData, options);
|
||||
@@ -75,7 +62,6 @@ export class ProcessesService {
|
||||
params = params.set("pageSize", "500");
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
|
||||
@@ -91,7 +77,7 @@ export class ProcessesService {
|
||||
// params = params.set("userid", userid);
|
||||
|
||||
// let options = {
|
||||
// headers: this.headers,
|
||||
//
|
||||
// params: params
|
||||
// };
|
||||
|
||||
@@ -109,7 +95,6 @@ export class ProcessesService {
|
||||
params = params.set("OnlyCount", onlycount.toString());
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
|
||||
@@ -124,7 +109,6 @@ export class ProcessesService {
|
||||
params = params.set("serialNumber", serialnumber);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -138,7 +122,6 @@ export class ProcessesService {
|
||||
/* params = params.set("serialNumber", serialnumber); */
|
||||
|
||||
let options = {
|
||||
headers: this.headers2,
|
||||
/* params: params */
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -151,7 +134,7 @@ export class ProcessesService {
|
||||
/* params = params.set("serialNumber", serialnumber); */
|
||||
|
||||
let options = {
|
||||
headers: this.headers2,
|
||||
|
||||
/* params: params */
|
||||
};
|
||||
return this.http.put<any>(`${geturl}`, object, options);
|
||||
@@ -164,7 +147,7 @@ export class ProcessesService {
|
||||
params = params.set("serialNumber", serialNumber);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, '', options);
|
||||
@@ -177,7 +160,6 @@ export class ProcessesService {
|
||||
params = params.set("onlyCount", onlyCount.toString());
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
|
||||
@@ -188,7 +170,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'Tasks/DelegateTask';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options);
|
||||
}
|
||||
@@ -200,7 +182,7 @@ export class ProcessesService {
|
||||
params = params.set("folderId", folderId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -213,7 +195,7 @@ export class ProcessesService {
|
||||
params = params.set("serialNumber", serialnumber);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -222,7 +204,7 @@ export class ProcessesService {
|
||||
GetMDOficialTasks(): Observable<any> {
|
||||
const geturl = environment.apiURL + 'tasks/GetMDOficialTasks';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
@@ -230,7 +212,7 @@ export class ProcessesService {
|
||||
GetMDPersonalTasks(): Observable<any> {
|
||||
const geturl = environment.apiURL + 'tasks/GetMDPersonalTasks';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
@@ -243,7 +225,7 @@ export class ProcessesService {
|
||||
params = params.set("onlyCount", count);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params,
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -253,7 +235,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'Tasks/Complete';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -262,7 +244,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'presidentialActions/signature';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -273,7 +255,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'Tasks/CompleteTask';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -282,7 +264,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'Tasks/CompleteTaskParecerPr';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -294,7 +276,7 @@ export class ProcessesService {
|
||||
params = params.set("FolderId", FolderId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, '', options);
|
||||
@@ -308,7 +290,7 @@ export class ProcessesService {
|
||||
params = params.set("applicationid", FsId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -317,7 +299,7 @@ export class ProcessesService {
|
||||
postDespatcho(body: any) {
|
||||
const geturl = environment.apiURL + 'Processes/CreateDispatch';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -325,7 +307,7 @@ export class ProcessesService {
|
||||
postDespatchoPr(body: any) {
|
||||
const geturl = environment.apiURL + 'Processes/CreateDispatchPR';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -350,7 +332,7 @@ export class ProcessesService {
|
||||
|
||||
const geturl = environment.apiURL + 'Processes/CreateParecer';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -374,7 +356,7 @@ export class ProcessesService {
|
||||
|
||||
const geturl = environment.apiURL + 'Processes/CreateParecerPR';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -382,7 +364,7 @@ export class ProcessesService {
|
||||
postDeferimento(body: any) {
|
||||
const geturl = environment.apiURL + 'Processes/CreateDeferimento';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
@@ -390,7 +372,7 @@ export class ProcessesService {
|
||||
GetActionsList() {
|
||||
const geturl = environment.apiURL + 'presidentialActions';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -400,7 +382,7 @@ export class ProcessesService {
|
||||
GetSubjectType() {
|
||||
const geturl = environment.apiURL + 'ecm/SubjectType';
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
@@ -414,7 +396,7 @@ export class ProcessesService {
|
||||
params = params.set("applicationId", FsId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -426,7 +408,7 @@ export class ProcessesService {
|
||||
url = url.replace('/V4/', '/V5/')
|
||||
|
||||
let options: any = {
|
||||
headers: this.headers,
|
||||
|
||||
}
|
||||
return this.http.post<any>(`${url}`, body, options);
|
||||
}
|
||||
@@ -442,7 +424,7 @@ export class ProcessesService {
|
||||
params = params.set("SourceLocation ", 17);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -456,7 +438,7 @@ export class ProcessesService {
|
||||
params = params.set("docid", DocId);
|
||||
|
||||
let options: any = {
|
||||
headers: this.headers,
|
||||
|
||||
params
|
||||
}
|
||||
|
||||
@@ -474,7 +456,7 @@ export class ProcessesService {
|
||||
params = params.set("applicationId", FsId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
@@ -484,7 +466,7 @@ export class ProcessesService {
|
||||
const geturl = environment.apiURL + 'Tasks/AttachDocImage';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, file, options);
|
||||
}
|
||||
@@ -495,7 +477,7 @@ export class ProcessesService {
|
||||
let params = new HttpParams();
|
||||
params = params.set('calendarName', calendarType);
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
|
||||
params: params
|
||||
};
|
||||
return this.http.post<any>(`${geturl}`, body, options);
|
||||
|
||||
@@ -203,7 +203,6 @@ export class TaskService {
|
||||
try {
|
||||
await this.loadExpedientes()
|
||||
this.loadCount = true;
|
||||
|
||||
} catch(error) {
|
||||
this.loadCount = true;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import { HttpClient, HttpEvent, HttpHeaders, HttpParams } from '@angular/common/
|
||||
import { z } from "zod";
|
||||
import { ok, err } from 'neverthrow';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { UserService } from 'src/app/module/user/domain/user.service'
|
||||
|
||||
/* import { ok, err } from 'neverthrow'; */
|
||||
|
||||
|
||||
@@ -18,22 +20,14 @@ export class MiddlewareServiceService {
|
||||
constructor(
|
||||
private HttpServiceService: HttpServiceService,
|
||||
private http: HttpClient,
|
||||
private UserService:UserService
|
||||
) {
|
||||
window["MiddlewareServiceService"] = this
|
||||
}
|
||||
|
||||
refreshToken(refreshToken: string) {
|
||||
const data = {
|
||||
refreshToken: refreshToken
|
||||
}
|
||||
|
||||
return this.HttpServiceService.put<refreshTokenDTO>(environment.apiURL + "UserAuthentication/RefreshToken", data, {})
|
||||
// .pipe(
|
||||
// map((response: HttpResponse<refreshToken>) => {
|
||||
// return response.body
|
||||
// })
|
||||
// );
|
||||
}
|
||||
// refreshToken(refreshToken: string) {
|
||||
// this.UserService.refreshToken()
|
||||
// }
|
||||
|
||||
// ================================ Calendar =================================================
|
||||
|
||||
|
||||
@@ -97,6 +97,21 @@ class SessionService {
|
||||
}
|
||||
|
||||
reset(user) {
|
||||
|
||||
if(user.RoleID) {
|
||||
if (user.RoleID == 100000014) {
|
||||
user.Profile = 'PR'
|
||||
} else if (user.RoleID == 100000011) {
|
||||
user.Profile = 'MDGPR'
|
||||
} else if (user.RoleID == 99999872) {
|
||||
user.Profile = 'Consultant'
|
||||
} else if (user.RoleID == 99999886) {
|
||||
user.Profile = 'SGGPR'
|
||||
} else {
|
||||
user.Profile = 'Unknown'
|
||||
}
|
||||
}
|
||||
|
||||
this._user = user
|
||||
|
||||
this.setInativity(true)
|
||||
|
||||
@@ -12,6 +12,17 @@
|
||||
<div class="title-content">
|
||||
<div class="div-title">
|
||||
<ion-label class="title font-25-em">Chat</ion-label>
|
||||
<!-- <input
|
||||
|
||||
[(ngModel)]="roomName"
|
||||
style="
|
||||
background: white;
|
||||
border: 1px solid black;
|
||||
height: 30px;
|
||||
margin-left: 10px;
|
||||
"
|
||||
(ngModelChange)="filterList()"
|
||||
/> -->
|
||||
</div>
|
||||
<div class="div-icon">
|
||||
|
||||
@@ -41,7 +52,7 @@
|
||||
<div class=" aside overflow-y-auto d-flex flex-wrap flex-grow-1">
|
||||
<div class="width-100">
|
||||
<div class="item item-hover width-100 d-flex ion-no-padding ion-no-margin"
|
||||
*ngFor="let room of rooms"
|
||||
*ngFor="let room of filterRoomList"
|
||||
[class.item-active]="room.$id == selectedRoomId" [class.hide-room]="room.roomType != segment">
|
||||
<div class="item-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.$id != selectedRoomId && room.roomType == RoomType.Group " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40.svg"></ion-icon>
|
||||
|
||||
@@ -62,6 +62,9 @@ export class ChatPage implements OnInit {
|
||||
//items$!: DexieObservable<RoomTable[]>;
|
||||
items$!: Observable<RoomTable[]>;
|
||||
rooms: RoomViewModel[] = [];
|
||||
filterRoomList: RoomViewModel[] = [];
|
||||
roomName = ''
|
||||
|
||||
private subscription: Subscription;
|
||||
expirationDate = {}
|
||||
private intervalSubscription: Subscription;
|
||||
@@ -119,7 +122,17 @@ export class ChatPage implements OnInit {
|
||||
);
|
||||
|
||||
// this.RoomSelected = this.rooms.filter(e => e.id == this.selectedRoomId)[0]
|
||||
this.filterList()
|
||||
}
|
||||
|
||||
filterList() {
|
||||
if(this.roomName) {
|
||||
this.filterRoomList = this.rooms.filter(e => e.roomName.toLocaleLowerCase().indexOf(this.roomName.toLocaleLowerCase()) >= 0)
|
||||
} else {
|
||||
this.filterRoomList = this.rooms
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// this.subscription = this.roomListSubject.pipe(
|
||||
// switchMap(roomList =>
|
||||
@@ -145,7 +158,6 @@ export class ChatPage implements OnInit {
|
||||
this.roomLocalDataSourceService.getItemsLive().pipe(
|
||||
map((roomList) => roomList.map((room)=> new RoomViewModel(room))),
|
||||
tap((roomList) => {
|
||||
console.log('update')
|
||||
this.updatemessage(roomList)
|
||||
})
|
||||
).subscribe()
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<!-- <button (click)="ChatMessageDebuggingPage()">Dev</button> -->
|
||||
<span *ngIf="roomStatus$ | async as roomStatus"><ion-icon *ngIf="roomStatus" class="online" name="ellipse"></ion-icon></span>
|
||||
</div>
|
||||
<!-- <div class="right" >
|
||||
<div class="right" *ngIf="roomType == RoomTypeEnum.Group">
|
||||
<button title="Menu" class="btn-no-color" (click)="_openMessagesOptions()" >
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
|
||||
</ion-icon>
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex header-bottom" >
|
||||
<div class="header-bottom-icon" *ngIf="roomType == RoomTypeEnum.Group">
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { InactivityPage } from './inactivity.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: InactivityPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class InactivityPageRoutingModule {}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { InactivityPageRoutingModule } from './inactivity-routing.module';
|
||||
|
||||
import { InactivityPage } from './inactivity.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
InactivityPageRoutingModule
|
||||
],
|
||||
declarations: [InactivityPage]
|
||||
})
|
||||
export class InactivityPageModule {}
|
||||
@@ -1,62 +0,0 @@
|
||||
<ion-content class="text-white">
|
||||
|
||||
<div class="main-wrapper">
|
||||
|
||||
<div class="main-content d-flex flex-column width " >
|
||||
|
||||
<div class="div-top-header header-fix">
|
||||
|
||||
<div class="div-logo">
|
||||
<img style="max-width: 90px;" *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/logo-bg-removebg-preview.png' alt='logo'>
|
||||
<img style="max-width: 80px;" *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class=" align-center justify-center d-flex flex-column width-100">
|
||||
<div *ngIf="SessionStore.hasPin" class="title">Digite o PIN</div>
|
||||
<div *ngIf="!SessionStore.hasPin" class="title">Digite o novo PIN</div>
|
||||
|
||||
<div class="terminal">
|
||||
<div class="d-flex pt-25 align-center justify-center pin-4">
|
||||
<div class="dot" [class.dot-active]="code.length >= 1"></div>
|
||||
<div class="dot" [class.dot-active]="code.length >= 2"></div>
|
||||
<div class="dot" [class.dot-active]="code.length >= 3"></div>
|
||||
<div class="dot"[class.dot-active]="code.length >= 4"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
|
||||
<div class="circle" (click)="setCode('1')">1</div> <div class="circle" (click)="setCode('2')">2</div> <div class="circle" (click)="setCode('3')">3</div>
|
||||
</div>
|
||||
|
||||
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
|
||||
<div class="circle" (click)="setCode('4')">4</div> <div class="circle" (click)="setCode('5')">5</div> <div class="circle" (click)="setCode('6')">6</div>
|
||||
</div>
|
||||
|
||||
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
|
||||
<div class="circle" (click)="setCode('7')">7</div> <div class="circle" (click)="setCode('8')">8</div> <div class="circle" (click)="setCode('9')">9</div>
|
||||
</div>
|
||||
|
||||
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
|
||||
<div class="circle" (click)="setCode('0')">0</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="voltar cursor-pointer d-flex align-center justify-center pt-25 clear" (click)="enterWithPasswordButton()" >
|
||||
Entrar com senha
|
||||
</div>
|
||||
|
||||
<div id="clear" class="cy-clear voltar cursor-pointer d-flex align-center justify-center pt-25 clear" (click)="clearCode()">
|
||||
Limpar
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</ion-content>
|
||||
@@ -1,349 +0,0 @@
|
||||
@import '~src/function.scss';
|
||||
:host, app-login {
|
||||
ion-content {
|
||||
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
|
||||
}
|
||||
}
|
||||
ion-content{
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
.main-wrapper{
|
||||
background: var(--PinBackground);
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
/* width: 400px; */
|
||||
height: auto;
|
||||
padding: 0 !important;
|
||||
/* margin: auto !important; */
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
|
||||
}
|
||||
|
||||
.logo{
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
|
||||
.bg-1{
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
background: #4cb9f825;
|
||||
margin: auto;
|
||||
.bg-2{
|
||||
width: 225px;
|
||||
height: 225px;
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
background: #61bdf2b4;
|
||||
margin: auto;
|
||||
.bg-3{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
background: #96d3f8be;
|
||||
margin: auto;
|
||||
.bg-4{
|
||||
width: 175px;
|
||||
height: 175px;
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.918);
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
|
||||
.bg-4 img{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.div-logo{
|
||||
width: 200px !important;
|
||||
margin: 0 auto;
|
||||
padding-bottom: 15px;
|
||||
|
||||
}
|
||||
.div-logo img{
|
||||
width: 100%;
|
||||
}
|
||||
.wrapper ion-input{
|
||||
font-size: rem(16);
|
||||
}
|
||||
.wrapper ion-button{
|
||||
font-size: medium;
|
||||
margin-top: 16px;
|
||||
}
|
||||
ion-item{
|
||||
--background: transparent;
|
||||
}
|
||||
.form{
|
||||
width: 300px;
|
||||
margin: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
.form-label{
|
||||
margin: 15px 0 5px 0;
|
||||
font-size: rem(15);
|
||||
}
|
||||
.form-input{
|
||||
--background: #fff;
|
||||
--color:#000;
|
||||
border-radius: 22.5px;
|
||||
margin: 10px 0 10px 0;
|
||||
}
|
||||
.btn-login{
|
||||
font-size: rem(16);
|
||||
}
|
||||
|
||||
|
||||
.div-top-header{
|
||||
margin: 0 em(20px);
|
||||
padding-top: em(15px);
|
||||
border: 0!important;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.div-logo {
|
||||
background: transparent;
|
||||
width: em(140px);
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
}
|
||||
.div-logo img{
|
||||
width: 100%;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.circle{
|
||||
color: white;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1rem(12);
|
||||
background: var(--PinDots);;
|
||||
border-radius: 56px;
|
||||
margin-bottom: 15px;
|
||||
user-select: none;
|
||||
margin-right: 15px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
|
||||
.title{
|
||||
padding-top: 32px;
|
||||
z-index: 1000;
|
||||
height: unset !important;
|
||||
position: relative;
|
||||
top: -30px;
|
||||
}
|
||||
|
||||
.terminal {
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-image: var(--PinCircleBackground);
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
background-size: 610px;
|
||||
}
|
||||
|
||||
.clear{
|
||||
color: var(--PinTextColor);
|
||||
font-size: rem(16);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.dot-active{
|
||||
background: var(--PinDots);
|
||||
}
|
||||
|
||||
.dot{
|
||||
width: rem(25);
|
||||
height: rem(25);
|
||||
margin: 0 10px 0 0;
|
||||
border: 3px solid var(--PinDots);
|
||||
box-sizing: border-box;
|
||||
border-radius: 50px;
|
||||
-webkit-border-radius: 50px;
|
||||
-moz-border-radius: 50px;
|
||||
-ms-border-radius: 50px;
|
||||
-o-border-radius: 50px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
width: 100vw;
|
||||
/* background-color: white; */
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
/* justify-content: center; */
|
||||
background-size: 686px 674px;
|
||||
background-position: center;
|
||||
background-position-y: 110px;
|
||||
background-repeat: no-repeat;
|
||||
margin: auto;
|
||||
/* justify-content: space-around; */
|
||||
}
|
||||
|
||||
.voltar{
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.msg-bottom{
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.msg-bottom-p{
|
||||
width: 220px;
|
||||
position: absolute;
|
||||
bottom: 0 !important;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-height: 746px){
|
||||
.msg-bottom-p {
|
||||
padding-top: 20px;
|
||||
position: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.pin-4 {
|
||||
z-index: 1000;
|
||||
margin-bottom: 107px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media only screen and (min-height: 168px) {
|
||||
.circle{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-bottom: 7px;
|
||||
margin-right: 7px;
|
||||
margin-left: 7px;
|
||||
}
|
||||
.terminal{
|
||||
margin-top: -33px !important;
|
||||
}
|
||||
|
||||
.pin-4 {
|
||||
position: relative;
|
||||
top: 49px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
padding-top: 10px !important;
|
||||
}
|
||||
|
||||
.div-top-header {
|
||||
position: unset ;
|
||||
top: unset ;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-height: 640px) {
|
||||
.circle{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-bottom: 9px;
|
||||
margin-right: 9px;
|
||||
margin-left: 9px;
|
||||
}
|
||||
.terminal{
|
||||
margin-top: -33px !important;
|
||||
}
|
||||
|
||||
.pin-4 {
|
||||
position: relative;
|
||||
top: 49px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-height: 667px) {
|
||||
.circle{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-bottom: 7px;
|
||||
margin-right: 7px;
|
||||
margin-left: 7px;
|
||||
}
|
||||
.terminal{
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.clear {
|
||||
padding-top: 25px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-height: 731px) {
|
||||
.circle{
|
||||
width: 63px;
|
||||
height: 63px;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.terminal{
|
||||
margin-top: -33px !important;
|
||||
}
|
||||
|
||||
.pin-4 {
|
||||
position: relative;
|
||||
top: 35px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-height: 832px) {
|
||||
.circle{
|
||||
width: 65px;
|
||||
height: 65px;
|
||||
margin-bottom: 15px;
|
||||
margin-right: 15px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.terminal{
|
||||
margin-top: -33px !important;
|
||||
}
|
||||
|
||||
.pin-4 {
|
||||
position: relative;
|
||||
top: unset !important;
|
||||
margin-bottom: 107px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.hide {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { InactivityPage } from './inactivity.page';
|
||||
|
||||
describe('InactivityPage', () => {
|
||||
let component: InactivityPage;
|
||||
let fixture: ComponentFixture<InactivityPage>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InactivityPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(InactivityPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,216 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { UserForm } from 'src/app/models/user.model';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { SessionStore} from 'src/app/module/user/domain/service/session.service'
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-inactivity',
|
||||
templateUrl: './inactivity.page.html',
|
||||
styleUrls: ['./inactivity.page.scss'],
|
||||
})
|
||||
export class InactivityPage implements OnInit {
|
||||
|
||||
username: string = environment.defaultuser;
|
||||
password: string = environment.defaultuserpwd;
|
||||
userattempt: UserForm;
|
||||
code = []
|
||||
setPin = false
|
||||
SessionStore = SessionStore
|
||||
enterWithPassword = false
|
||||
|
||||
constructor(
|
||||
private notificatinsservice: NotificationsService,
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private toastService: ToastService,
|
||||
public alertController: AlertController,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
) { }
|
||||
|
||||
loop = false
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
runloop() {
|
||||
|
||||
}
|
||||
|
||||
async presentAlert(message: string) {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Mensagem do sistema',
|
||||
message: message,
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateUsername() {
|
||||
return (
|
||||
this.username.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
validatePassword() {
|
||||
return (
|
||||
this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
async Login() {
|
||||
|
||||
if (this.validateUsername()) {
|
||||
if (this.validatePassword()) {
|
||||
|
||||
this.userattempt = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
domainName: environment.domain,
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
let attempt = await this.authService.login(this.userattempt, { saveSession: false })
|
||||
|
||||
if (attempt) {
|
||||
|
||||
|
||||
// if current attemp is equal to the current user
|
||||
if (attempt.UserId == SessionStore.user.wxUserId) {
|
||||
// await this.authService.SetSession(attempt, this.userattempt);
|
||||
|
||||
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
// this.authService.loginChat();
|
||||
}
|
||||
|
||||
this.getToken();
|
||||
SessionStore.setInativity(true)
|
||||
|
||||
this.goback()
|
||||
} else {
|
||||
SessionStore.delete()
|
||||
window.localStorage.clear();
|
||||
|
||||
SessionStore.setInativity(true)
|
||||
// await this.authService.SetSession(attempt, this.userattempt);
|
||||
}
|
||||
|
||||
this.enterWithPassword = false
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService._badRequest('Por favor, insira a sua palavra-passe');
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
|
||||
}
|
||||
}
|
||||
|
||||
getToken() {
|
||||
this.notificatinsservice.requestPermissions();
|
||||
this.notificatinsservice.registrationError();
|
||||
// this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
setCode(code: string) {
|
||||
|
||||
if (this.code.length < 4) {
|
||||
this.code.push(code)
|
||||
}
|
||||
|
||||
if (this.code.length == 4) {
|
||||
|
||||
if (!SessionStore.hasPin) {
|
||||
//
|
||||
this.storePin()
|
||||
this.pinLogin()
|
||||
} else {
|
||||
this.pinLogin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearCode() {
|
||||
this.code = []
|
||||
}
|
||||
|
||||
pinLogin() {
|
||||
|
||||
const code = this.code.join('')
|
||||
|
||||
if (SessionStore.validatePin(code)) {
|
||||
|
||||
SessionStore.setInativity(true)
|
||||
this.goback()
|
||||
|
||||
setTimeout(() => {
|
||||
this.clearCode()
|
||||
}, 3000)
|
||||
|
||||
} else {
|
||||
this.toastService._badRequest('Pin incorreto')
|
||||
this.code = []
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goback() {
|
||||
const pathName = this.SessionStore.preference.UrlBeforeInactivity
|
||||
if (pathName) {
|
||||
this.router.navigate([pathName], { replaceUrl: true });
|
||||
} else {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {
|
||||
//When user has got access to Agenda but does not have their own calendar, goes to Agenda
|
||||
//if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore?.user?.OwnerCalendars?.length == 0) {
|
||||
if (this.p.userPermission(this.p.permissionList.Agenda.access)) {
|
||||
this.router.navigate(['/home/agenda']);
|
||||
}
|
||||
else {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
}
|
||||
//If user has access permission to both Chat and Action, goes to Chat by default.
|
||||
else if ((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if (this.p.userPermission(this.p.permissionList.Actions.access)) {
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
|
||||
|
||||
}, 100)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
storePin() {
|
||||
|
||||
const code = this.code.join('');
|
||||
SessionStore.setPin(code);
|
||||
|
||||
}
|
||||
|
||||
enterWithPasswordButton() {
|
||||
this.enterWithPassword = true
|
||||
SessionStore.forceToLoginWithForceToLogInWithPassword = true
|
||||
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { LoginPage } from './login.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: LoginPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class LoginPageRoutingModule {}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { LoginPageRoutingModule } from './login-routing.module';
|
||||
|
||||
import { LoginPage } from './login.page';
|
||||
import { UserModule } from 'src/app/module/user/user.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
LoginPageRoutingModule,
|
||||
// UserModule
|
||||
],
|
||||
declarations: [
|
||||
LoginPage
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class LoginPageModule {}
|
||||
@@ -1,46 +0,0 @@
|
||||
<ion-content class="text-white">
|
||||
<div class="main-wrapper">
|
||||
<div class="wrapper">
|
||||
<div class="bg-1 d-flex justify-center align-center">
|
||||
<div class="bg-2 d-flex justify-center align-center">
|
||||
<div class="bg-3 d-flex justify-center align-center">
|
||||
<div class="bg-4 d-flex justify-center align-center">
|
||||
<div class="div-logo">
|
||||
|
||||
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/donit.jpg' alt='logo'>
|
||||
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
|
||||
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/doneit.jpg' alt='logo'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <h3 class="center text-white">doneIT</h3> -->
|
||||
<h3 class="center text-white">Gabinete Digital</h3>
|
||||
<form class="form">
|
||||
<p class="form-label">Email</p>
|
||||
<ion-item class="form-input">
|
||||
<ion-input class="cy-email" type="text" [(ngModel)]="username" name="input-username"></ion-input>
|
||||
</ion-item>
|
||||
<p class="form-label">Palavra-passe</p>
|
||||
<ion-item class="form-input">
|
||||
<ion-input class="cy-password" (keyup.enter)="Login()" [type]="showPassword ? 'text' : 'password' " [(ngModel)]="password" name="input-password" ></ion-input>
|
||||
<div (click)="togglePassword()">
|
||||
<ion-icon slot="end" [name]="passwordIcon" ></ion-icon>
|
||||
</div>
|
||||
</ion-item>
|
||||
<div class="d-flex pt-25">
|
||||
<button class="btn-ok btn-login {{ Cy.p.login.b.enter }}" fill="clear" expand="block" shape="round" (click)="Login()">Iniciar a sessão</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="msg-bottom d-flex">
|
||||
<p class="msg-bottom-p"> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ion-icon style="width: 0px; height: 0px;" src='assets/images/theme/gov/icons-search.svg'></ion-icon>
|
||||
<ion-icon style="width: 0px; height: 0px;" src='assets/images/icons-most-searched-words-open.svg'></ion-icon>
|
||||
|
||||
</ion-content>
|
||||
@@ -1,219 +0,0 @@
|
||||
@import '~src/function.scss';
|
||||
:host, app-login {
|
||||
ion-content {
|
||||
background: linear-gradient(180deg, #c0ccd3 0%, #737b80 100%) !important;
|
||||
}
|
||||
}
|
||||
ion-content{
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
.main-wrapper{
|
||||
background: var(--login-background);
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
|
||||
}
|
||||
.wrapper{
|
||||
width: rem(400);
|
||||
height: auto;
|
||||
padding: 0 !important;
|
||||
margin: auto !important;
|
||||
overflow: auto;
|
||||
}
|
||||
.logo{
|
||||
width: rem(400);
|
||||
height: rem(400);
|
||||
background-image: url("/assets/background/auth.svg");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.bg-1{
|
||||
width: rem(250);
|
||||
height: rem(250);
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
margin: auto;
|
||||
.bg-2{
|
||||
width: rem(225);
|
||||
height: rem(225);
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
margin: auto;
|
||||
.bg-3{
|
||||
width: rem(200);
|
||||
height: rem(200);
|
||||
overflow: auto;
|
||||
border-radius: 50%;
|
||||
margin: auto;
|
||||
.bg-4{
|
||||
width: rem(175);
|
||||
height: rem(175);
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
background-color: #fff !important;
|
||||
|
||||
.bg-4 img{
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.div-logo{
|
||||
width: rem(200) !important;
|
||||
margin: 0 auto;
|
||||
padding: rem(15) !important;
|
||||
|
||||
}
|
||||
.div-logo img{
|
||||
width: 100%;
|
||||
}
|
||||
.wrapper ion-input{
|
||||
font-size: rem(16);
|
||||
}
|
||||
.wrapper ion-button{
|
||||
font-size: medium;
|
||||
margin-top: 16px;
|
||||
}
|
||||
ion-item{
|
||||
--background: transparent;
|
||||
}
|
||||
.form{
|
||||
width: rem(300);
|
||||
margin: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
.form-label{
|
||||
margin: rem(15) 0 rem(5) 0;
|
||||
font-size: rem(15);
|
||||
color: var(--login-label-text);
|
||||
}
|
||||
.form-input{
|
||||
--background: #fff;
|
||||
--color:#000;
|
||||
border-radius: 22.5px;
|
||||
margin: rem(10) 0 rem(10) 0;
|
||||
}
|
||||
|
||||
.btn-login{
|
||||
font-size: rem(16);
|
||||
background-color: #F2F2F2 !important;
|
||||
color: #000;
|
||||
}
|
||||
.btn-login:hover{
|
||||
background-color: var(--button-hover);
|
||||
}
|
||||
|
||||
.div-top-header{
|
||||
margin: 0 em(20);
|
||||
padding-top: em(15);
|
||||
border: 0!important;
|
||||
}
|
||||
|
||||
.div-logo {
|
||||
background: transparent;
|
||||
width: rem(140);
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
}
|
||||
.div-logo img{
|
||||
width: 100%;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
|
||||
.circle{
|
||||
color: white;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: rem(25);
|
||||
background: #44b5ea;
|
||||
border-radius: 56px;
|
||||
margin-left: 30px;
|
||||
margin-bottom: 15px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.title {
|
||||
padding-top: 32px;
|
||||
}
|
||||
|
||||
.terminal {
|
||||
padding-top: 112px;
|
||||
margin-left: -30px;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.clear{
|
||||
color: #44b5ea;
|
||||
font-size: rem(16);
|
||||
}
|
||||
.dot-active{
|
||||
background: #44b5ea;
|
||||
}
|
||||
|
||||
.dot{
|
||||
width: rem(25);
|
||||
height: rem(25);
|
||||
margin: 0 10px 0 0;
|
||||
border: 3px solid #44b5ea;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50px;
|
||||
-webkit-border-radius: 50px;
|
||||
-moz-border-radius: 50px;
|
||||
-ms-border-radius: 50px;
|
||||
-o-border-radius: 50px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-image: url("/assets/background/auth.svg");
|
||||
background-size: 686px 674px;
|
||||
background-position: center;
|
||||
background-position-y: 110px;
|
||||
background-repeat: no-repeat;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.voltar{
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.msg-bottom{
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.msg-bottom-p {
|
||||
width: rem(220);
|
||||
position: absolute;
|
||||
bottom: 0 !important;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-height: 746px) {
|
||||
.msg-bottom-p {
|
||||
padding-top: rem(20);
|
||||
position: unset !important;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { LoginPage } from './login.page';
|
||||
|
||||
describe('LoginPage', () => {
|
||||
let component: LoginPage;
|
||||
let fixture: ComponentFixture<LoginPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoginPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(LoginPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,299 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { UserForm } from 'src/app/models/user.model';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { SessionStore} from 'src/app/module/user/domain/service/session.service'
|
||||
import { ClearStoreService } from 'src/app/services/clear-store.service';
|
||||
import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { Cy } from 'cypress/enum'
|
||||
import { AgendaDataRepositoryService } from 'src/app/module/agenda/data/repository/agenda-data-repository.service';
|
||||
import { NotificationRepositoryService } from 'src/app/module/notification/data/notification-repository.service'
|
||||
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
|
||||
import { RoomLocalRepository } from 'src/app/module/chat/data/repository/room/room-local-repository.service'
|
||||
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service'
|
||||
import { UserService } from 'src/app/module/user/domain/user.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.page.html',
|
||||
styleUrls: ['./login.page.scss'],
|
||||
})
|
||||
export class LoginPage implements OnInit {
|
||||
|
||||
logstatus: boolean;
|
||||
username: string = environment.defaultuser;
|
||||
password: string = environment.defaultuserpwd;
|
||||
userattempt: UserForm;
|
||||
code = []
|
||||
|
||||
hasPin: boolean
|
||||
loginPreference: string
|
||||
|
||||
sessionStore = SessionStore;
|
||||
showPassword = false;
|
||||
passwordIcon = "eye";
|
||||
Cy = Cy
|
||||
|
||||
constructor(
|
||||
private notificatinsservice: NotificationsService,
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private toastService: ToastService,
|
||||
public alertController: AlertController,
|
||||
private clearStoreService: ClearStoreService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private platform: Platform,
|
||||
private storage: Storage,
|
||||
private storageService: StorageService,
|
||||
private NotificationHolderService: NotificationHolderService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||
private NotificationRepositoryService: NotificationRepositoryService,
|
||||
private ChatServiceService: ChatServiceService,
|
||||
private RoomLocalRepository: RoomLocalRepository,
|
||||
private MessageLocalDataSourceService: MessageLocalDataSourceService,
|
||||
//private UserService: UserService
|
||||
) { }
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
togglePassword() {
|
||||
this.showPassword = !this.showPassword;
|
||||
|
||||
if (this.passwordIcon == "eye") {
|
||||
this.passwordIcon = "eye-off";
|
||||
} else {
|
||||
this.passwordIcon = "eye";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateUsername() {
|
||||
return (
|
||||
this.username.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
validatePassword() {
|
||||
return (
|
||||
this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
getToken() {
|
||||
try {
|
||||
|
||||
this.notificatinsservice.requestPermissions();
|
||||
this.notificatinsservice.registrationError();
|
||||
// this.notificatinsservice.getAndpostToken(this.username);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async Login() {
|
||||
|
||||
|
||||
if (this.validateUsername()) {
|
||||
if (this.validatePassword()) {
|
||||
|
||||
let newUserName = ""
|
||||
if (this.usernameAsDomain(environment.domain, this.username.trim())) {
|
||||
newUserName = this.username.trim();
|
||||
} else {
|
||||
newUserName = this.username.trim() + "@" + environment.domain;
|
||||
}
|
||||
|
||||
|
||||
// const loader = this.toastService.loading()
|
||||
// SessionStore.delete();
|
||||
// window.localStorage.clear();
|
||||
// await this.UserService.login({
|
||||
// username: newUserName.trim(),
|
||||
// password: this.password.trim(),
|
||||
// domainName: environment.domain,
|
||||
// BasicAuthKey: ""
|
||||
// })
|
||||
// await this.RoomLocalRepository.clear()
|
||||
// await this.MessageLocalDataSourceService.clear()
|
||||
// await this.NotificationRepositoryService.clearData()
|
||||
// this.ChatServiceService.start()
|
||||
|
||||
// await this.AgendaDataRepositoryService.clearSharedCalendar()
|
||||
|
||||
// this.clearStoreService.clear();
|
||||
// // this.ChatSystemService.clearChat();
|
||||
// this.NotificationHolderService.clear()
|
||||
|
||||
|
||||
// this.storage.clear();
|
||||
|
||||
// // await this.authService.SetSession(attempt, this.userattempt);
|
||||
// // this.NotificationRepositoryService.init()
|
||||
// /* CPSession.save(data) */
|
||||
|
||||
// //this.changeProfileService.run();
|
||||
|
||||
// //this.storageService.remove("Notifications")
|
||||
|
||||
// // this.getToken();
|
||||
|
||||
if (!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
|
||||
if (this.sessionStore.hasPin) {
|
||||
this.router.navigateByUrl('/home/events');
|
||||
} else {
|
||||
this.router.navigateByUrl('/pin', { replaceUrl: true });
|
||||
}
|
||||
|
||||
} else {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
//SessionStore.hasPassLogin = true;
|
||||
|
||||
|
||||
//loader.remove()
|
||||
|
||||
|
||||
// let attempt = await this.authService.login(this.userattempt, { saveSession: false })
|
||||
/* const data = await this.authService.loginContenteProduction(this.userattempt, { saveSession: true }) */
|
||||
|
||||
|
||||
|
||||
|
||||
// if (attempt) {
|
||||
|
||||
// if (attempt.UserId == SessionStore.user.wxUserId) {
|
||||
|
||||
// // await this.authService.SetSession(attempt, this.userattempt);
|
||||
// // this.changeProfileService.run();
|
||||
|
||||
// // if (attempt.ChatData) {
|
||||
|
||||
// // try {
|
||||
|
||||
// // await this.AgendaDataRepositoryService.getSharedCalendar()
|
||||
|
||||
// // this.NotificationHolderService.clear()
|
||||
// // await this.authService.loginToChatWs();
|
||||
|
||||
|
||||
// // this.NotificationRepositoryService.init()
|
||||
|
||||
// // } catch(error) {
|
||||
// // console.log("faild to clear chat")
|
||||
// // }
|
||||
|
||||
// // }
|
||||
|
||||
// // this.changeProfileService.runLogin();
|
||||
|
||||
// // this.getToken();
|
||||
// // SessionStore.setInativity(true);
|
||||
// // SessionStore.hasPassLogin = true;
|
||||
|
||||
// // this.goback();
|
||||
// // this.ChatServiceService.start()
|
||||
|
||||
// } else {
|
||||
|
||||
// // await this.RoomLocalRepository.clear()
|
||||
// // await this.MessageLocalDataSourceService.clear()
|
||||
// // await this.NotificationRepositoryService.clearData()
|
||||
// // this.ChatServiceService.start()
|
||||
|
||||
// // await this.AgendaDataRepositoryService.clearSharedCalendar()
|
||||
|
||||
// // this.clearStoreService.clear();
|
||||
// // // this.ChatSystemService.clearChat();
|
||||
// // this.NotificationHolderService.clear()
|
||||
// // SessionStore.delete();
|
||||
// // window.localStorage.clear();
|
||||
// // this.storage.clear();
|
||||
|
||||
// // await this.authService.SetSession(attempt, this.userattempt);
|
||||
// // this.NotificationRepositoryService.init()
|
||||
// // /* CPSession.save(data) */
|
||||
|
||||
// // this.changeProfileService.run();
|
||||
|
||||
// // this.storageService.remove("Notifications")
|
||||
|
||||
// // this.getToken();
|
||||
|
||||
// // if (!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
|
||||
// // if (this.sessionStore.hasPin) {
|
||||
// // this.router.navigateByUrl('/home/events');
|
||||
// // } else {
|
||||
// // this.router.navigateByUrl('/pin', { replaceUrl: true });
|
||||
// // }
|
||||
|
||||
// // } else {
|
||||
// // this.router.navigate(['/home/events']);
|
||||
// // }
|
||||
|
||||
// // SessionStore.hasPassLogin = true;
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
else{
|
||||
this.toastService._badRequest('Ocorreu um problema por favor valide o username e password');
|
||||
} */
|
||||
}
|
||||
else {
|
||||
this.toastService._badRequest('Por favor, insira a sua palavra-passe');
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
goback() {
|
||||
const pathName = SessionStore.preference.UrlBeforeInactivity
|
||||
if (pathName) {
|
||||
this.router.navigate([pathName]);
|
||||
} else {
|
||||
if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {
|
||||
//When user has got access to Agenda but does not have their own calendar, goes to Agenda
|
||||
//if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore?.user?.OwnerCalendars.length == 0) {
|
||||
if (this.p.userPermission(this.p.permissionList.Agenda.access)) {
|
||||
this.router.navigate(['/home/agenda']);
|
||||
}
|
||||
else {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
}
|
||||
//If user has access permission to both Chat and Action, goes to Chat by default.
|
||||
else if ((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if (this.p.userPermission(this.p.permissionList.Actions.access)) {
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
usernameAsDomain(substring, mainString) {
|
||||
return mainString.includes(substring);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "652252e47",
|
||||
"SHA": "652252e47882a8b5adf832e5dfd9f0ba0f43579b",
|
||||
"shortSHA": "dad392335",
|
||||
"SHA": "dad392335e0043ef66332a82dd2e524e714443c2",
|
||||
"branch": "feature/login-v2",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Thu Nov 7 10:51:58 2024 +0100'",
|
||||
"lastCommitMessage": "fix edit event to approve",
|
||||
"lastCommitNumber": "6132",
|
||||
"changeStatus": "On branch feature/login-v2\nYour branch is up to date with 'origin/feature/login-v2'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/core/user/repository/user-remote-repository.ts\n\tnew file: src/app/core/user/use-case/user-log-out-use-case.service.ts\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/module/user/data/datasource/user-remote-repository.service.ts\n\tmodified: src/app/module/user/domain/user.service.ts\n\tmodified: src/app/ui/agenda/component/event-list/event-list.page.ts\n\tmodified: version/git-version.ts",
|
||||
"lastCommitTime": "'Thu Nov 7 11:15:01 2024 +0100'",
|
||||
"lastCommitMessage": "add logout v2",
|
||||
"lastCommitNumber": "6133",
|
||||
"changeStatus": "On branch feature/login-v2\nYour branch is up to date with 'origin/feature/login-v2'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tdeleted: src/app/Rules/user.service.spec.ts\n\tdeleted: src/app/Rules/user.service.ts\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/core/chat/repository/room/room-remote-repository.ts\n\tmodified: src/app/core/chat/usecase/room/room-get-list-use-case.service.ts\n\tnew file: src/app/core/chat/usecase/room/room-search-by-name.service.ts\n\tmodified: src/app/core/user/repository/user-remote-repository.ts\n\tmodified: src/app/core/user/use-case/user-login-use-case.service.ts\n\tnew file: src/app/core/user/use-case/user-refresh-token.service.ts\n\tmodified: src/app/guards/auth.guard.ts\n\tmodified: src/app/infra/database/dexie/instance/chat/service.ts\n\tdeleted: src/app/interceptors/chatToken.interceptor.ts\n\tmodified: src/app/interceptors/token.interceptors.ts\n\tmodified: src/app/modals/create-process/create-process.page.ts\n\tmodified: src/app/modals/profile/profile.module.ts\n\tmodified: src/app/models/despacho.model.ts\n\tmodified: src/app/module/chat/data/repository/room/room-remote-repository.service.ts\n\tmodified: src/app/module/user/data/datasource/user-remote-repository.service.ts\n\tmodified: src/app/module/user/domain/user.service.ts\n\tmodified: src/app/module/user/user.module.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/pages/login/login.module.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/services/auth.service.ts\n\tmodified: src/app/services/processes.service.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/API/middleware/middleware-service.service.ts\n\tmodified: src/app/store/session.service.ts\n\tmodified: src/app/ui/chat/chat.page.html\n\tmodified: src/app/ui/chat/chat.page.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tdeleted: src/app/ui/login/inactivity/inactivity-routing.module.ts\n\tdeleted: src/app/ui/login/inactivity/inactivity.module.ts\n\tdeleted: src/app/ui/login/inactivity/inactivity.page.html\n\tdeleted: src/app/ui/login/inactivity/inactivity.page.scss\n\tdeleted: src/app/ui/login/inactivity/inactivity.page.spec.ts\n\tdeleted: src/app/ui/login/inactivity/inactivity.page.ts\n\tdeleted: src/app/ui/login/login/login-routing.module.ts\n\tdeleted: src/app/ui/login/login/login.module.ts\n\tdeleted: src/app/ui/login/login/login.page.html\n\tdeleted: src/app/ui/login/login/login.page.scss\n\tdeleted: src/app/ui/login/login/login.page.spec.ts\n\tdeleted: src/app/ui/login/login/login.page.ts",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user