2019-11-14 14:19:59 +09:00
|
|
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
2019-09-18 15:02:21 +09:00
|
|
|
|
2019-09-26 14:38:21 +09:00
|
|
|
import { Store, select } from '@ngrx/store';
|
2019-09-18 15:02:21 +09:00
|
|
|
|
2019-09-26 14:38:21 +09:00
|
|
|
import { Company } from '@ucap-webmessenger/api-external';
|
2020-01-10 17:09:08 +09:00
|
|
|
import { ServerErrorCode, ProtocolService } from '@ucap-webmessenger/protocol';
|
2019-09-18 15:02:21 +09:00
|
|
|
|
2019-09-26 14:38:21 +09:00
|
|
|
import * as AppStore from '@app/store';
|
|
|
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
|
|
|
import * as CompanyStore from '@app/store/setting/company';
|
2019-11-14 14:19:59 +09:00
|
|
|
import { Observable, Subscription } from 'rxjs';
|
2019-10-02 17:12:51 +09:00
|
|
|
import { Router } from '@angular/router';
|
2019-11-14 14:19:59 +09:00
|
|
|
import { tap, map } from 'rxjs/operators';
|
|
|
|
import {
|
|
|
|
DialogService,
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
} from '@ucap-webmessenger/ui';
|
|
|
|
import { StringUtil } from '@ucap-webmessenger/core';
|
2019-12-15 14:49:52 +09:00
|
|
|
import {
|
|
|
|
NoticeDialogComponent,
|
|
|
|
NoticeDialogResult,
|
|
|
|
NoticeDialogData
|
|
|
|
} from '@app/layouts/messenger/dialogs/account/notice.dialog.component';
|
2019-09-18 15:02:21 +09:00
|
|
|
|
2019-12-15 22:49:35 +09:00
|
|
|
import { environment } from '../../../../environments/environment';
|
2020-01-03 17:39:44 +09:00
|
|
|
import {
|
|
|
|
LocalStorageService,
|
|
|
|
SessionStorageService
|
|
|
|
} from '@ucap-webmessenger/web-storage';
|
2019-12-15 22:49:35 +09:00
|
|
|
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
2020-01-03 17:39:44 +09:00
|
|
|
import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types';
|
2020-01-10 17:09:08 +09:00
|
|
|
import { AppAuthenticationService } from '@app/services/authentication.service';
|
|
|
|
import { logoutInitialize } from '@app/store/account/authentication';
|
2019-12-15 22:49:35 +09:00
|
|
|
|
2019-09-18 15:02:21 +09:00
|
|
|
@Component({
|
|
|
|
selector: 'app-page-account-login',
|
|
|
|
templateUrl: './login.page.component.html',
|
|
|
|
styleUrls: ['./login.page.component.scss']
|
|
|
|
})
|
2019-11-14 14:19:59 +09:00
|
|
|
export class LoginPageComponent implements OnInit, OnDestroy {
|
2019-12-15 17:43:16 +09:00
|
|
|
fixedCompany: string;
|
|
|
|
fixedNotiBtnText: string;
|
|
|
|
|
2019-09-26 14:38:21 +09:00
|
|
|
companyList$: Observable<Company[]>;
|
2019-09-18 15:02:21 +09:00
|
|
|
|
2019-11-14 14:19:59 +09:00
|
|
|
loginFailureCount: Subscription;
|
|
|
|
|
|
|
|
defatulLoginBtnText: string;
|
|
|
|
loginBtnText: string;
|
|
|
|
loginBtnEnable: boolean;
|
|
|
|
|
|
|
|
timeChecker: any;
|
|
|
|
defatulWaitingTime: number;
|
|
|
|
waitingTime: number;
|
|
|
|
|
2019-12-15 22:49:35 +09:00
|
|
|
appUserInfo: AppUserInfo;
|
|
|
|
useRememberMe: boolean;
|
|
|
|
useAutoLogin: boolean;
|
|
|
|
|
2019-12-20 09:36:46 +09:00
|
|
|
rotateInfomationIntervalObject: any;
|
|
|
|
rotateInfomationIndex = 0;
|
|
|
|
rotateInfomation = [
|
|
|
|
{
|
|
|
|
index: 0,
|
|
|
|
content: `“ 고객의식탁에 건강한 먹거리와 행복한 미래를 제공합니다.”`,
|
|
|
|
info: `늘 가족의 곁에서 가족의 건강만을 생각하는 마음으로 진한 사랑과 정성을 담으려 합니다. 전통적인 맛에 현대적인 감각과 전문성을 더해, 건강한 식생활 문화를 다양한 곳으로 전달합니다.`
|
|
|
|
},
|
|
|
|
{
|
|
|
|
index: 1,
|
|
|
|
content: `“ 세계시장에 깊고 온화한 한국의 맛을 전파합니다! ”`,
|
|
|
|
info: `대상은 산업근대화 시기인 지난 70년대 초반, 국내 최초의 플랜트 수출 성공사례로 평가 받고 있는 인도네시아 진출을 계기로 해외시장 개척의 새로운 장을 열었습니다.
|
|
|
|
사람과 자연을 존중하는 대상의 기업정신에 한국 전통 문화와 정서를 담아 세계인의 마음에 깊고 단단한 뿌리를 내리고 있습니다.`
|
|
|
|
},
|
|
|
|
{
|
|
|
|
index: 2,
|
|
|
|
content: `“ 나눌수록 맛있는 행복을 전합니다 ”`,
|
|
|
|
info: `다 함께 행복할 수 있는 세상을 만들기 위해 대상은 사회적 책임을 다합니다.
|
|
|
|
대상은 고객감동경영을 실천하고자 건강한 기업문화를 확립하여 이를 토대로 인재를 육성하고, 미래를 만들어갑니다.
|
|
|
|
뿐만 아니라 고객과 비전을 공유하여 함께 꿈을 꾸고, 다양한 사회공헌활동을 통해 사회의 건강과 행복을 위해 노력하며,나눌수록 맛있는 행복을 실천하고 있습니다`
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2019-11-14 14:19:59 +09:00
|
|
|
constructor(
|
|
|
|
private store: Store<any>,
|
|
|
|
private router: Router,
|
2019-12-15 22:49:35 +09:00
|
|
|
private dialogService: DialogService,
|
2020-01-10 17:09:08 +09:00
|
|
|
private protocolService: ProtocolService,
|
2020-01-03 17:39:44 +09:00
|
|
|
private localStorageService: LocalStorageService,
|
2020-01-10 17:09:08 +09:00
|
|
|
private sessionStorageService: SessionStorageService,
|
|
|
|
private appAuthenticationService: AppAuthenticationService
|
2019-12-15 22:49:35 +09:00
|
|
|
) {
|
|
|
|
this.useRememberMe =
|
|
|
|
environment.productConfig.authentication.rememberMe.use;
|
|
|
|
this.useAutoLogin = environment.productConfig.authentication.autoLogin.use;
|
|
|
|
|
|
|
|
this.appUserInfo = this.localStorageService.encGet<AppUserInfo>(
|
|
|
|
KEY_APP_USER_INFO,
|
|
|
|
environment.customConfig.appKey
|
|
|
|
);
|
2019-12-20 09:36:46 +09:00
|
|
|
|
|
|
|
this.rotateInfomationIndex =
|
|
|
|
new Date().getTime() % this.rotateInfomation.length;
|
2019-12-15 22:49:35 +09:00
|
|
|
}
|
2019-09-18 15:02:21 +09:00
|
|
|
|
|
|
|
ngOnInit(): void {
|
2020-01-10 17:09:08 +09:00
|
|
|
// this.appAuthenticationService.logout();
|
|
|
|
this.protocolService.disconnect();
|
|
|
|
this.store.dispatch(logoutInitialize());
|
|
|
|
|
2019-12-20 09:36:46 +09:00
|
|
|
this.rotateInfomationIntervalObject = setInterval(() => {
|
|
|
|
this.rotateInfomationIndex =
|
|
|
|
(this.rotateInfomationIndex + 1) % this.rotateInfomation.length;
|
|
|
|
}, 8000);
|
|
|
|
|
2019-11-14 14:19:59 +09:00
|
|
|
this.defatulLoginBtnText = 'LOGIN';
|
|
|
|
this.defatulWaitingTime = 5 * 60; // sec
|
|
|
|
|
2019-09-26 14:38:21 +09:00
|
|
|
this.store.dispatch(
|
|
|
|
CompanyStore.companyList({
|
2019-12-16 09:58:01 +09:00
|
|
|
companyGroupCode: environment.companyConfig.companyGroupCode
|
2019-09-26 14:38:21 +09:00
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
this.companyList$ = this.store.pipe(
|
|
|
|
select(AppStore.SettingSelector.CompanySelector.companyList)
|
|
|
|
);
|
2019-11-14 14:19:59 +09:00
|
|
|
|
|
|
|
this.loginFailureCount = this.store
|
|
|
|
.pipe(
|
|
|
|
select(AppStore.AccountSelector.AuthenticationSelector.loginFailCount),
|
|
|
|
map(count => {
|
|
|
|
if (count > 0) {
|
|
|
|
if (count < 5) {
|
|
|
|
this.dialogService.open<
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
width: '360px',
|
|
|
|
data: {
|
2019-11-29 16:08:24 +09:00
|
|
|
title: '로그인',
|
2019-11-14 14:19:59 +09:00
|
|
|
html: `아이디 또는 패스워드가<br/>일치하지 않습니다.`
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count === 5) {
|
|
|
|
this.dialogService.open<
|
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
width: '360px',
|
|
|
|
data: {
|
2019-11-29 16:08:24 +09:00
|
|
|
title: '로그인',
|
2019-11-14 14:19:59 +09:00
|
|
|
html: `비밀번호 오류 횟수 초과입니다.<br/>비밀번호를 확인하신 후<br/>잠시 후 다시 시작해 주세요.`
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.timeChecker = setInterval(() => this.getCheckTime(), 1000);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (!!this.timeChecker) {
|
|
|
|
clearInterval(this.timeChecker);
|
|
|
|
}
|
|
|
|
this.waitingTime = this.defatulWaitingTime;
|
|
|
|
this.loginBtnText = this.defatulLoginBtnText;
|
|
|
|
this.loginBtnEnable = true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
2019-12-15 17:43:16 +09:00
|
|
|
|
|
|
|
this.customInitilize();
|
|
|
|
}
|
|
|
|
|
2020-01-03 17:39:44 +09:00
|
|
|
async customInitilize() {
|
|
|
|
const personLogout: LogoutInfo = this.sessionStorageService.get(
|
|
|
|
KEY_LOGOUT_INFO
|
|
|
|
);
|
|
|
|
|
|
|
|
if (
|
|
|
|
!!personLogout &&
|
|
|
|
!!personLogout.reasonCode &&
|
|
|
|
personLogout.reasonCode === ServerErrorCode.ERRCD_DUPLICATE
|
|
|
|
) {
|
2020-01-10 17:09:08 +09:00
|
|
|
const result = this.dialogService.open<
|
2020-01-03 17:39:44 +09:00
|
|
|
AlertDialogComponent,
|
|
|
|
AlertDialogData,
|
|
|
|
AlertDialogResult
|
|
|
|
>(AlertDialogComponent, {
|
|
|
|
width: '360px',
|
|
|
|
data: {
|
|
|
|
title: '',
|
|
|
|
html: `다른 디바이스에서 로그인하였습니다.<br/> * Ip : ${personLogout.ip}<br/> * Mac : ${personLogout.mac}`
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.sessionStorageService.set<LogoutInfo>(KEY_LOGOUT_INFO, {
|
|
|
|
personLogout: true
|
|
|
|
} as LogoutInfo);
|
|
|
|
}
|
|
|
|
|
2019-12-15 17:43:16 +09:00
|
|
|
// Daesang..
|
2019-12-16 08:53:06 +09:00
|
|
|
this.fixedCompany = environment.companyConfig.fixedCompanyCode;
|
2019-12-15 17:43:16 +09:00
|
|
|
this.fixedNotiBtnText = '이용 주의사항';
|
2019-11-14 14:19:59 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
if (!!this.loginFailureCount) {
|
|
|
|
this.loginFailureCount.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getCheckTime() {
|
|
|
|
if (this.waitingTime <= 0) {
|
|
|
|
// reset.
|
|
|
|
if (!!this.timeChecker) {
|
|
|
|
clearInterval(this.timeChecker);
|
|
|
|
}
|
|
|
|
this.waitingTime = this.defatulWaitingTime;
|
|
|
|
this.loginBtnText = this.defatulLoginBtnText;
|
|
|
|
this.loginBtnEnable = true;
|
|
|
|
} else {
|
|
|
|
// wait.
|
|
|
|
this.waitingTime = this.waitingTime - 1;
|
|
|
|
|
|
|
|
this.loginBtnText = `${StringUtil.zeroFill(
|
|
|
|
Math.floor(this.waitingTime / 60),
|
|
|
|
2
|
|
|
|
)}:${StringUtil.zeroFill(this.waitingTime % 60, 2)}`;
|
|
|
|
this.loginBtnEnable = false;
|
|
|
|
}
|
2019-09-18 15:02:21 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
onLogin(value: {
|
|
|
|
companyCode: string;
|
|
|
|
loginId: string;
|
|
|
|
loginPw: string;
|
|
|
|
rememberMe: boolean;
|
2019-12-15 22:49:35 +09:00
|
|
|
autoLogin: boolean;
|
2019-09-18 15:02:21 +09:00
|
|
|
notValid: () => void;
|
|
|
|
}) {
|
|
|
|
this.store.dispatch(
|
2019-09-24 09:23:30 +09:00
|
|
|
AuthenticationStore.webLogin({
|
2019-09-18 15:02:21 +09:00
|
|
|
loginInfo: {
|
|
|
|
companyCode: value.companyCode,
|
2019-09-27 12:53:21 +09:00
|
|
|
companyGroupType: 'C',
|
2019-09-18 15:02:21 +09:00
|
|
|
loginId: value.loginId,
|
|
|
|
loginPw: value.loginPw
|
|
|
|
},
|
2019-12-15 22:49:35 +09:00
|
|
|
rememberMe: value.rememberMe,
|
|
|
|
autoLogin: value.autoLogin
|
2019-09-18 15:02:21 +09:00
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2019-10-02 17:12:51 +09:00
|
|
|
|
2019-12-15 14:49:52 +09:00
|
|
|
onClickNoti() {
|
|
|
|
// For Daesang,,
|
|
|
|
this.dialogService.open<
|
|
|
|
NoticeDialogComponent,
|
|
|
|
NoticeDialogData,
|
|
|
|
NoticeDialogResult
|
|
|
|
>(NoticeDialogComponent, {
|
|
|
|
width: '500px',
|
|
|
|
data: {
|
|
|
|
title: '이용시 주의사항',
|
|
|
|
html: `
|
|
|
|
<p>1. 메신저 계정/비밀번호를 타인에게 공유하지 않아야 합니다.</p>
|
|
|
|
<p>2. 회사 중요정보(고객정보 포함)를 업무상 필요한 인원에게 필요한 만큼만 공유해야 합니다.</p>
|
|
|
|
<p>3. 퇴근, 회의 등 자리를 비우는 경우 중요자료가 방치되지 않도록 주의하고, Clean Desk를 실천해야 합니다.</p>
|
|
|
|
<p>4. 메신저를 누군가 허락 없이 함부로 열람하고 그 내부 내용을 타인과 공유하지 않아야 합니다.</p>
|
|
|
|
<p>5. 공용PC에 메신저 사용 후 반드시 로그아웃 하시기 바랍니다.</p>
|
|
|
|
<p>6. 사내메신저는 업무용 협업도구입니다. 비업무용 소통을 자제하시기 바랍니다.</p>
|
|
|
|
<p>7. 업무상 인지한 정보(개인의 프라이버시 포함)나 일반인에게 공개되지 않은 회사기록을 통해 얻은 정보는 오직 회사의 이익을 위해서 활용하여야 하며 사외에 유출하거나 타인에게 알려주거나 업무 이외의 목적에 사용하여서는 아니 됩니다.</p>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
});
|
2019-10-02 17:12:51 +09:00
|
|
|
}
|
2019-12-15 14:49:52 +09:00
|
|
|
|
2019-12-20 09:36:46 +09:00
|
|
|
onClickNextInfomation() {
|
|
|
|
this.rotateInfomationIndex =
|
|
|
|
(this.rotateInfomationIndex + 1) % this.rotateInfomation.length;
|
|
|
|
|
|
|
|
if (!!this.rotateInfomationIntervalObject) {
|
|
|
|
clearInterval(this.rotateInfomationIntervalObject);
|
|
|
|
this.rotateInfomationIntervalObject = setInterval(() => {
|
|
|
|
this.rotateInfomationIndex =
|
|
|
|
(this.rotateInfomationIndex + 1) % this.rotateInfomation.length;
|
|
|
|
}, 8000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-15 14:49:52 +09:00
|
|
|
// onClickTemplate() {
|
|
|
|
// this.router.navigate(['/template']);
|
|
|
|
// }
|
2019-09-18 15:02:21 +09:00
|
|
|
}
|