member_webapp/@overflow/member/component/member-totp.component.ts
2018-05-28 19:28:26 +09:00

50 lines
1.2 KiB
TypeScript

import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
@Component({
selector: 'of-member-totp',
templateUrl: './member-totp.component.html',
})
export class MemberTotpComponent implements OnInit {
@Input() member;
@Input() totp;
@Output() totpRegist = new EventEmitter<{code: string, secretCode: string}>();
@Output() totpCreate = new EventEmitter();
selectedItem: any;
totpSettingDisplay = false;
headerItem: string;
totpCode: string;
lists = [];
constructor() { }
ngOnInit() {
this.lists = [
{id: 1, name: 'Email', value: this.member.email, description: 'blabla', },
{id: 2, name: 'Phone', value: this.member.phone, description: 'blabla', },
{id: 3, name: 'Google 2factor', value: this.member.totpType, description: 'blabla', },
];
}
on2factorConfig(event: Event, item: any) {
this.selectedItem = item;
// server totp regist member info modify
if (this.selectedItem.id === 3) {
this.headerItem = '구글 인증기 설정하기';
this.totpSettingDisplay = true;
this.totpCreate.emit();
}
}
totpInput(e) {
if ( e.target.value.length === 6 ) {
this.totpRegist.emit(e.target.value);
}
return;
}
}