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 867b1918..79a0978a 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 @@ -53,7 +53,10 @@ import { import { AppAuthenticationService } from '@app/services/authentication.service'; import { NGXLogger } from 'ngx-logger'; import { Store } from '@ngrx/store'; -import { SessionStorageService } from '@ucap-webmessenger/web-storage'; +import { + SessionStorageService, + LocalStorageService +} from '@ucap-webmessenger/web-storage'; import { AuthenticationProtocolService, @@ -73,6 +76,8 @@ import { UserPasswordSetResponse } from '@ucap-webmessenger/protocol-service'; import { DaesangUrlInfoResponse } from '@ucap-webmessenger/api-external'; +import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; +import { DaesangCipherService } from '@ucap-webmessenger/daesang'; @Injectable() export class Effects { @@ -309,7 +314,21 @@ export class Effects { weblink => weblink.key === 'WebLinkChgPassword' ); if (passwordChangeUrl.length > 0) { - this.nativeService.openDefaultBrowser(passwordChangeUrl[0].url); + const appUserInfo = this.localStorageService.encGet( + KEY_APP_USER_INFO, + environment.customConfig.appKey + ); + const loginPw = appUserInfo.loginPw; + const loginId = appUserInfo.loginId; + + const url = passwordChangeUrl[0].url + .replace(/(\(%USER_ID%\))/g, loginId) + .replace( + /(\(%USER_PASS%\))/g, + this.daesangCipherService.encryptForWebLink(loginPw) + ); + + this.nativeService.openDefaultBrowser(url); } this.store.dispatch(logout()); @@ -455,6 +474,7 @@ export class Effects { private ngZone: NgZone, private router: Router, private store: Store, + private localStorageService: LocalStorageService, private sessionStorageService: SessionStorageService, private piService: PiService, private appAuthenticationService: AppAuthenticationService, @@ -464,6 +484,7 @@ export class Effects { private dialogService: DialogService, private snackBarService: SnackBarService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, - private logger: NGXLogger + private logger: NGXLogger, + private daesangCipherService: DaesangCipherService ) {} } diff --git a/projects/ucap-webmessenger-daesang/src/lib/services/daesang-cipher.service.ts b/projects/ucap-webmessenger-daesang/src/lib/services/daesang-cipher.service.ts index 8ba8a014..587d0340 100644 --- a/projects/ucap-webmessenger-daesang/src/lib/services/daesang-cipher.service.ts +++ b/projects/ucap-webmessenger-daesang/src/lib/services/daesang-cipher.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; - +import CryptoJS from 'crypto-js'; import crypto from 'crypto'; import { CipherUtil } from '../utils/CipherUtil'; @@ -34,4 +34,10 @@ export class DaesangCipherService { return cipherChunks.join(''); } + + encryptForWebLink(pvSource: string): string { + return CryptoJS.SHA1(pvSource) + .toString() + .toUpperCase(); + } }