+
+
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();
}