From a986b3a370779c9af3c11282219573dad9005f4c Mon Sep 17 00:00:00 2001 From: leejh Date: Tue, 15 Oct 2019 09:31:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20//=20remember=20Me=20=EA=B0=92=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85=20=EC=B2=98=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/components/login.component.html | 9 ++----- .../src/lib/components/login.component.ts | 27 +++++++++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.html b/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.html index cbddde99..3e803dc4 100644 --- a/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.html +++ b/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.html @@ -35,13 +35,8 @@ -
- +
+ Remember Me diff --git a/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.ts b/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.ts index ed774837..02a1143c 100644 --- a/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.ts +++ b/projects/ucap-webmessenger-ui-account/src/lib/components/login.component.ts @@ -9,6 +9,8 @@ import { } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { Company } from '@ucap-webmessenger/api-external'; +import { LocalStorageService } from '@ucap-webmessenger/web-storage'; +import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; @Component({ selector: 'ucap-account-login', @@ -32,13 +34,28 @@ export class LoginComponent implements OnInit { loginForm: FormGroup; - constructor(private formBuilder: FormBuilder) {} + constructor( + private formBuilder: FormBuilder, + private localStorageService: LocalStorageService + ) {} ngOnInit() { + const loginInfo: LoginInfo = this.localStorageService.get( + KEY_LOGIN_INFO + ); + let companyCode = ''; + let loginId = ''; + let remember = false; + if (loginInfo && loginInfo.companyCode && loginInfo.loginId) { + companyCode = loginInfo.companyCode; + loginId = loginInfo.loginId; + remember = true; + } this.loginForm = this.formBuilder.group({ - companyCode: ['', [Validators.required]], - loginId: ['', [Validators.required]], - loginPw: ['', Validators.required] + companyCode: [companyCode, [Validators.required]], + loginId: [loginId, [Validators.required]], + loginPw: ['', Validators.required], + remember: [remember] }); } @@ -47,7 +64,7 @@ export class LoginComponent implements OnInit { companyCode: this.loginForm.get('companyCode').value, loginId: this.loginForm.get('loginId').value, loginPw: this.loginForm.get('loginPw').value, - rememberMe: true, + rememberMe: this.loginForm.get('remember').value, notValid: () => { this.loginPwElementRef.nativeElement.focus(); }