diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 6765a305..01183491 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -445,8 +445,6 @@ ipcMain.on( const downloadPath = args[0] as string; if (!!downloadPath && downloadPath.length > 0) { - console.log('in electron', downloadPath); - appStorage.downloadPath = downloadPath; log.info('downloadPath is changed to ', appStorage.downloadPath); diff --git a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts index bd099cd9..bc462712 100644 --- a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts +++ b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts @@ -16,6 +16,7 @@ import { import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; import { environment } from '../../environments/environment'; import * as AuthenticationStore from '@app/store/account/authentication'; +import { KEY_LOGOUT_INFO, LogoutInfo } from '@app/types'; @Injectable({ providedIn: 'root' @@ -42,14 +43,14 @@ export class AppAutoLoginGuard implements CanActivate { environment.customConfig.appKey ); - const personLogout: boolean = this.sessionStorageService.get( - 'PERSON_LOGOUT' + const personLogout: LogoutInfo = this.sessionStorageService.get( + KEY_LOGOUT_INFO ); if ( !!appUserInfo && appUserInfo.settings.general.autoLogin && - !personLogout + !personLogout.personLogout ) { this.store.dispatch( AuthenticationStore.webLogin({ diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index 5ffa719e..2a704c77 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -857,7 +857,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { this.nativeService .selectSaveFilePath(value.fileInfo.fileName) .then(result => { - console.log(result); if (!!result && result.length > 0) { this.saveFile(value, result); } else { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts index 6a05e426..a3d4740b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts @@ -104,8 +104,6 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { this.editableProfileImage = environment.productConfig.CommonSetting.editableProfileImage; - - console.log(data.openProfileOptions); } ngOnInit() { diff --git a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts index cf60a6fa..681f25b0 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts @@ -3,6 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { Store, select } from '@ngrx/store'; import { Company } from '@ucap-webmessenger/api-external'; +import { ServerErrorCode } from '@ucap-webmessenger/protocol'; import * as AppStore from '@app/store'; import * as AuthenticationStore from '@app/store/account/authentication'; @@ -24,8 +25,12 @@ import { } from '@app/layouts/messenger/dialogs/account/notice.dialog.component'; import { environment } from '../../../../environments/environment'; -import { LocalStorageService } from '@ucap-webmessenger/web-storage'; +import { + LocalStorageService, + SessionStorageService +} from '@ucap-webmessenger/web-storage'; import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; +import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types'; @Component({ selector: 'app-page-account-login', @@ -79,7 +84,8 @@ export class LoginPageComponent implements OnInit, OnDestroy { private store: Store, private router: Router, private dialogService: DialogService, - private localStorageService: LocalStorageService + private localStorageService: LocalStorageService, + private sessionStorageService: SessionStorageService ) { this.useRememberMe = environment.productConfig.authentication.rememberMe.use; @@ -163,7 +169,33 @@ export class LoginPageComponent implements OnInit, OnDestroy { this.customInitilize(); } - customInitilize() { + async customInitilize() { + const personLogout: LogoutInfo = this.sessionStorageService.get( + KEY_LOGOUT_INFO + ); + + if ( + !!personLogout && + !!personLogout.reasonCode && + personLogout.reasonCode === ServerErrorCode.ERRCD_DUPLICATE + ) { + const result = await this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + width: '360px', + data: { + title: '', + html: `다른 디바이스에서 로그인하였습니다.
* Ip : ${personLogout.ip}
* Mac : ${personLogout.mac}` + } + }); + + this.sessionStorageService.set(KEY_LOGOUT_INFO, { + personLogout: true + } as LogoutInfo); + } + // Daesang.. this.fixedCompany = environment.companyConfig.fixedCompanyCode; this.fixedNotiBtnText = '이용 주의사항'; diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts index 59fe0492..5f4f9d1b 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts @@ -307,7 +307,7 @@ export class MainPageComponent implements OnInit, OnDestroy { .pipe( take(1), map(res => { - console.log(res); + this.logger.debug(res); }), catchError(error => of(this.logger.debug(error))) ) diff --git a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts index c3a93584..ebd1d012 100644 --- a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts @@ -10,7 +10,9 @@ import { KEY_LOGIN_INFO, KEY_LOGIN_RES_INFO, KEY_VER_INFO, - KEY_URL_INFO + KEY_URL_INFO, + KEY_LOGOUT_INFO, + LogoutInfo } from '../types'; import { PasswordUtil } from '@ucap-webmessenger/pi'; @@ -96,7 +98,7 @@ export class AppAuthenticationService { environment.customConfig.appKey ); - this.sessionStorageService.remove('PERSON_LOGOUT'); + this.sessionStorageService.remove(KEY_LOGOUT_INFO); } logout() { @@ -104,7 +106,5 @@ export class AppAuthenticationService { this.sessionStorageService.remove(KEY_VER_INFO); this.sessionStorageService.remove(KEY_LOGIN_INFO); this.sessionStorageService.remove(KEY_URL_INFO); - - this.sessionStorageService.set('PERSON_LOGOUT', true); } } diff --git a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts index 6bfc401e..4d0a4963 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -10,7 +10,8 @@ import { SSVC_TYPE_LOGOUT_REMOTE_NOTI, AuthenticationProtocolService, LogoutResponse, - LogoutRemoteNotification + LogoutRemoteNotification, + LogoutNotification } from '@ucap-webmessenger/protocol-authentication'; import { NGXLogger } from 'ngx-logger'; @@ -97,13 +98,17 @@ import { SSVC_TYPE_UMG_NOTI, UmgNotiNotification } from '@ucap-webmessenger/protocol-umg'; -import { LocalStorageService } from '@ucap-webmessenger/web-storage'; +import { + LocalStorageService, + SessionStorageService +} from '@ucap-webmessenger/web-storage'; import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; import { environment } from '../../environments/environment'; import { NotificationMethod } from '@ucap-webmessenger/core'; import { Dictionary } from '@ngrx/entity'; import { MessageType } from '@ucap-webmessenger/api-message'; +import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types'; @Injectable() export class AppNotificationService { @@ -117,6 +122,7 @@ export class AppNotificationService { private statusProtocolService: StatusProtocolService, private umgProtocolService: UmgProtocolService, private localStorageService: LocalStorageService, + private sessionStorageService: SessionStorageService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private store: Store, private logger: NGXLogger @@ -129,11 +135,18 @@ export class AppNotificationService { switch (notiOrRes.SSVC_TYPE) { case SSVC_TYPE_LOGOUT_RES: { - const res = notiOrRes as LogoutResponse; + const res = notiOrRes as LogoutNotification; this.logger.debug( 'Notification::authenticationProtocolService::LogoutResponse', res ); + + this.sessionStorageService.set(KEY_LOGOUT_INFO, { + personLogout: true, + reasonCode: res.reasonCode, + ip: res.ip, + mac: res.mac + } as LogoutInfo); } break; case SSVC_TYPE_LOGOUT_REMOTE_NOTI: diff --git a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts index 18bf25cf..6f4e3641 100644 --- a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts @@ -48,7 +48,9 @@ import { KEY_LOGIN_INFO, EnvironmentsInfo, KEY_ENVIRONMENTS_INFO, - KEY_URL_INFO + KEY_URL_INFO, + LogoutInfo, + KEY_LOGOUT_INFO } from '@app/types'; import { AppAuthenticationService } from '@app/services/authentication.service'; import { NGXLogger } from 'ngx-logger'; @@ -174,6 +176,10 @@ export class Effects { switchMap(action => { return this.authenticationProtocolService.logout({}).pipe( map(res => { + this.sessionStorageService.set(KEY_LOGOUT_INFO, { + personLogout: true + } as LogoutInfo); + this.store.dispatch(loginRedirect()); }), catchError(error => of(error)) diff --git a/projects/ucap-webmessenger-app/src/app/types/index.ts b/projects/ucap-webmessenger-app/src/app/types/index.ts index 4d21b5e1..44ba29af 100644 --- a/projects/ucap-webmessenger-app/src/app/types/index.ts +++ b/projects/ucap-webmessenger-app/src/app/types/index.ts @@ -1,5 +1,6 @@ export * from './environment.type'; export * from './login-info.type'; +export * from './logout-info.type'; export * from './userselect.dialog.type'; export * from './right-drawer.type'; export * from './sticker-info.type'; diff --git a/projects/ucap-webmessenger-app/src/app/types/logout-info.type.ts b/projects/ucap-webmessenger-app/src/app/types/logout-info.type.ts new file mode 100644 index 00000000..b07b1575 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/types/logout-info.type.ts @@ -0,0 +1,8 @@ +export const KEY_LOGOUT_INFO = 'ucap::LOGOUT_INFO'; + +export interface LogoutInfo { + personLogout: boolean; + reasonCode?: number; + ip?: string; + mac?: string; +} diff --git a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts index 1f4abbae..18235515 100644 --- a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts +++ b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts @@ -74,7 +74,7 @@ export class BrowserNativeService extends NativeService { getNetworkInfo(): Promise { return new Promise((resolve, reject) => { - resolve(null); + resolve([{ ip: 'Browser', mac: 'browser' }]); }); } diff --git a/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/logout.ts b/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/logout.ts index d18d2ab8..87de30c6 100644 --- a/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/logout.ts +++ b/projects/ucap-webmessenger-protocol-authentication/src/lib/protocols/logout.ts @@ -5,7 +5,8 @@ import { ProtocolDecoder, ProtocolMessage, PacketBody, - decodeProtocolMessage + decodeProtocolMessage, + ProtocolNotification } from '@ucap-webmessenger/protocol'; // tslint:disable-next-line: no-empty-interface @@ -15,6 +16,12 @@ export interface LogoutResponse extends ProtocolResponse { reasonCode?: number; } +export interface LogoutNotification extends ProtocolNotification { + reasonCode?: number; + ip?: string; + mac?: string; +} + export const encodeLogout: ProtocolEncoder = ( req: LogoutRequest ) => { @@ -27,6 +34,16 @@ export const decodeLogout: ProtocolDecoder = ( message: ProtocolMessage ) => { return decodeProtocolMessage(message, { - reasonCode: message.bodyList[0] + reasonCode: Number(message.bodyList[0]) } as LogoutResponse); }; + +export const decodeLogoutNotification: ProtocolDecoder = ( + message: ProtocolMessage +) => { + return decodeProtocolMessage(message, { + reasonCode: Number(message.bodyList[0]), + ip: !!message.bodyList[1] ? message.bodyList[1] : '', + mac: !!message.bodyList[2] ? message.bodyList[2] : '' + } as LogoutNotification); +}; diff --git a/projects/ucap-webmessenger-protocol-authentication/src/lib/services/authentication-protocol.service.ts b/projects/ucap-webmessenger-protocol-authentication/src/lib/services/authentication-protocol.service.ts index 8ec7a9c8..368d5034 100644 --- a/projects/ucap-webmessenger-protocol-authentication/src/lib/services/authentication-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-authentication/src/lib/services/authentication-protocol.service.ts @@ -23,7 +23,8 @@ import { LogoutRequest, LogoutResponse, encodeLogout, - decodeLogout + decodeLogout, + decodeLogoutNotification } from '../protocols/logout'; import { encodeLogoutRemote, @@ -56,7 +57,9 @@ export class AuthenticationProtocolService { switch (message.subServiceType) { case SSVC_TYPE_LOGOUT_RES: { - this.logoutNotificationSubject.next(decodeLogout(message)); + this.logoutNotificationSubject.next( + decodeLogoutNotification(message) + ); } break; case SSVC_TYPE_LOGOUT_REMOTE_NOTI: diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/sound-viewer.component.ts b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/sound-viewer.component.ts index e4a053c3..b870c7dc 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/sound-viewer.component.ts +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/sound-viewer.component.ts @@ -61,7 +61,6 @@ export class SoundViewerComponent implements OnInit { } onChangeTimeSlider(e: MatSliderChange): void { - console.log('onChangeTimeSlider', e.value); this.audioPlayer.nativeElement.currentTime = e.value; } diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/video-viewer.component.ts b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/video-viewer.component.ts index f0ab6894..de03c16e 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/video-viewer.component.ts +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/video-viewer.component.ts @@ -61,7 +61,6 @@ export class VideoViewerComponent implements OnInit { } onChangeTimeSlider(e: MatSliderChange): void { - console.log('onChangeTimeSlider', e.value); this.audioPlayer.nativeElement.currentTime = e.value; } diff --git a/projects/ucap-webmessenger-ui/src/lib/data-source/virtual-scroll-tree-flat.data-source.ts b/projects/ucap-webmessenger-ui/src/lib/data-source/virtual-scroll-tree-flat.data-source.ts index 1987f671..d3a40ac0 100644 --- a/projects/ucap-webmessenger-ui/src/lib/data-source/virtual-scroll-tree-flat.data-source.ts +++ b/projects/ucap-webmessenger-ui/src/lib/data-source/virtual-scroll-tree-flat.data-source.ts @@ -115,7 +115,6 @@ export class VirtualScrollTreeFlatDataSource extends DataSource { } disconnect() { - console.log('VirtualScrollTreeFlatDataSource disconnect'); if (!!this.connectSubject) { this.connectSubject.next(); this.connectSubject.unsubscribe();