자동로그인 수정 / 로그아웃 수정.

This commit is contained in:
leejinho 2019-12-16 09:58:01 +09:00
parent ffb79c7de0
commit 0a3e8a9df0
5 changed files with 31 additions and 6 deletions

View File

@ -9,7 +9,10 @@ import {
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
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 { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
import { environment } from '../../environments/environment'; import { environment } from '../../environments/environment';
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
@ -21,7 +24,8 @@ export class AppAutoLoginGuard implements CanActivate {
constructor( constructor(
private router: Router, private router: Router,
private store: Store<any>, private store: Store<any>,
private localStorageService: LocalStorageService private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService
) {} ) {}
canActivate( canActivate(
@ -38,7 +42,11 @@ export class AppAutoLoginGuard implements CanActivate {
environment.customConfig.appKey environment.customConfig.appKey
); );
if (!!appUserInfo && appUserInfo.autoLogin) { const personLogout: boolean = this.sessionStorageService.get(
'PERSON_LOGOUT'
);
if (!!appUserInfo && appUserInfo.autoLogin && !personLogout) {
this.store.dispatch( this.store.dispatch(
AuthenticationStore.webLogin({ AuthenticationStore.webLogin({
loginInfo: { loginInfo: {

View File

@ -150,7 +150,7 @@
<ucap-profile-my-profile-widget <ucap-profile-my-profile-widget
[profileImageRoot]="sessionVerinfo.profileRoot" [profileImageRoot]="sessionVerinfo.profileRoot"
[profileImageFile]="loginRes.userInfo.profileImageFile" [profileImageFile]="getMyProfileImageWidget()"
(click)="onClickOpenProfile(loginRes.userInfo)" (click)="onClickOpenProfile(loginRes.userInfo)"
class="myprofile" class="myprofile"
></ucap-profile-my-profile-widget> ></ucap-profile-my-profile-widget>

View File

@ -437,4 +437,12 @@ export class LeftSideComponent implements OnInit, OnDestroy {
) )
.subscribe(); .subscribe();
} }
getMyProfileImageWidget(): string {
if (!!this.loginRes) {
return this.loginRes.userInfo.profileImageFile;
} else {
return '';
}
}
} }

View File

@ -74,7 +74,7 @@ export class LoginPageComponent implements OnInit, OnDestroy {
this.store.dispatch( this.store.dispatch(
CompanyStore.companyList({ CompanyStore.companyList({
companyGroupCode: 'LG' companyGroupCode: environment.companyConfig.companyGroupCode
}) })
); );

View File

@ -9,7 +9,8 @@ import {
LoginInfo, LoginInfo,
KEY_LOGIN_INFO, KEY_LOGIN_INFO,
KEY_LOGIN_RES_INFO, KEY_LOGIN_RES_INFO,
KEY_VER_INFO KEY_VER_INFO,
KEY_URL_INFO
} from '../types'; } from '../types';
import { PasswordUtil } from '@ucap-webmessenger/pi'; import { PasswordUtil } from '@ucap-webmessenger/pi';
import { DaesangCipherService } from '@ucap-webmessenger/daesang'; import { DaesangCipherService } from '@ucap-webmessenger/daesang';
@ -64,6 +65,9 @@ export class AppAuthenticationService {
if (rememberMe || autoLogin) { if (rememberMe || autoLogin) {
appUserInfo = { appUserInfo = {
...appUserInfo, ...appUserInfo,
companyGroupType: loginInfo.companyGroupType,
companyCode: loginInfo.companyCode,
loginId: loginInfo.loginId,
loginPw: autoLogin ? loginInfo.loginPw : undefined, loginPw: autoLogin ? loginInfo.loginPw : undefined,
rememberMe, rememberMe,
autoLogin autoLogin
@ -75,11 +79,16 @@ export class AppAuthenticationService {
appUserInfo, appUserInfo,
environment.customConfig.appKey environment.customConfig.appKey
); );
this.sessionStorageService.remove('PERSON_LOGOUT');
} }
logout() { logout() {
this.sessionStorageService.remove(KEY_LOGIN_RES_INFO); this.sessionStorageService.remove(KEY_LOGIN_RES_INFO);
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.set<boolean>('PERSON_LOGOUT', true);
} }
} }