login refactoring
This commit is contained in:
parent
5530f769c6
commit
1cb5af9174
|
@ -3,7 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
import { Company } from '@ucap-webmessenger/api-external';
|
import { Company } from '@ucap-webmessenger/api-external';
|
||||||
import { ServerErrorCode } from '@ucap-webmessenger/protocol';
|
import { ServerErrorCode, ProtocolService } from '@ucap-webmessenger/protocol';
|
||||||
|
|
||||||
import * as AppStore from '@app/store';
|
import * as AppStore from '@app/store';
|
||||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
@ -31,6 +31,8 @@ import {
|
||||||
} from '@ucap-webmessenger/web-storage';
|
} from '@ucap-webmessenger/web-storage';
|
||||||
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
||||||
import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types';
|
import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types';
|
||||||
|
import { AppAuthenticationService } from '@app/services/authentication.service';
|
||||||
|
import { logoutInitialize } from '@app/store/account/authentication';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-account-login',
|
selector: 'app-page-account-login',
|
||||||
|
@ -84,8 +86,10 @@ export class LoginPageComponent implements OnInit, OnDestroy {
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private protocolService: ProtocolService,
|
||||||
private localStorageService: LocalStorageService,
|
private localStorageService: LocalStorageService,
|
||||||
private sessionStorageService: SessionStorageService
|
private sessionStorageService: SessionStorageService,
|
||||||
|
private appAuthenticationService: AppAuthenticationService
|
||||||
) {
|
) {
|
||||||
this.useRememberMe =
|
this.useRememberMe =
|
||||||
environment.productConfig.authentication.rememberMe.use;
|
environment.productConfig.authentication.rememberMe.use;
|
||||||
|
@ -101,6 +105,10 @@ export class LoginPageComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
// this.appAuthenticationService.logout();
|
||||||
|
this.protocolService.disconnect();
|
||||||
|
this.store.dispatch(logoutInitialize());
|
||||||
|
|
||||||
this.rotateInfomationIntervalObject = setInterval(() => {
|
this.rotateInfomationIntervalObject = setInterval(() => {
|
||||||
this.rotateInfomationIndex =
|
this.rotateInfomationIndex =
|
||||||
(this.rotateInfomationIndex + 1) % this.rotateInfomation.length;
|
(this.rotateInfomationIndex + 1) % this.rotateInfomation.length;
|
||||||
|
@ -179,7 +187,7 @@ export class LoginPageComponent implements OnInit, OnDestroy {
|
||||||
!!personLogout.reasonCode &&
|
!!personLogout.reasonCode &&
|
||||||
personLogout.reasonCode === ServerErrorCode.ERRCD_DUPLICATE
|
personLogout.reasonCode === ServerErrorCode.ERRCD_DUPLICATE
|
||||||
) {
|
) {
|
||||||
const result = await this.dialogService.open<
|
const result = this.dialogService.open<
|
||||||
AlertDialogComponent,
|
AlertDialogComponent,
|
||||||
AlertDialogData,
|
AlertDialogData,
|
||||||
AlertDialogResult
|
AlertDialogResult
|
||||||
|
|
|
@ -12,7 +12,8 @@ import {
|
||||||
KEY_VER_INFO,
|
KEY_VER_INFO,
|
||||||
KEY_URL_INFO,
|
KEY_URL_INFO,
|
||||||
KEY_LOGOUT_INFO,
|
KEY_LOGOUT_INFO,
|
||||||
LogoutInfo
|
LogoutInfo,
|
||||||
|
KEY_AUTH_INFO
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { PasswordUtil } from '@ucap-webmessenger/pi';
|
import { PasswordUtil } from '@ucap-webmessenger/pi';
|
||||||
|
|
||||||
|
@ -106,5 +107,6 @@ export class AppAuthenticationService {
|
||||||
this.sessionStorageService.remove(KEY_VER_INFO);
|
this.sessionStorageService.remove(KEY_VER_INFO);
|
||||||
this.sessionStorageService.remove(KEY_LOGIN_INFO);
|
this.sessionStorageService.remove(KEY_LOGIN_INFO);
|
||||||
this.sessionStorageService.remove(KEY_URL_INFO);
|
this.sessionStorageService.remove(KEY_URL_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_AUTH_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,9 @@ export class ProtocolService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public disconnect(): void {
|
public disconnect(): void {
|
||||||
this.messagesSubscription.unsubscribe();
|
if (!!this.messagesSubscription) {
|
||||||
|
this.messagesSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get serverMessage(): Observable<ProtocolMessage> {
|
public get serverMessage(): Observable<ProtocolMessage> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user