This commit is contained in:
병준 박 2019-10-15 11:07:36 +09:00
commit 3b8b2b2ced
2 changed files with 24 additions and 12 deletions

View File

@ -35,13 +35,8 @@
</mat-error>
</mat-form-field>
<div
class="remember-forgot-password"
fxLayout="row"
fxLayout.xs="column"
fxLayoutAlign="space-between center"
>
<mat-checkbox class="remember-me" aria-label="Remember Me">
<div class="remember-forgot-password" fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-between center">
<mat-checkbox class="remember-me" formControlName="remember" aria-label="Remember Me">
Remember Me
</mat-checkbox>

View File

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