로그인 페이지 //
remember Me 값에 따라 기본값 세팅 처리.
This commit is contained in:
parent
142631428a
commit
a986b3a370
|
@ -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>
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user