import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import { DomainMember } from '@overflow/commons-typescript/model/domain'; import { Member } from '@overflow/commons-typescript/model/member'; @Component({ selector: 'of-member-totp', templateUrl: './member-totp.component.html', }) export class MemberTotpComponent implements OnInit { @Input() domainMember: DomainMember; @Input() totp; @Output() regist = new EventEmitter<{member: Member, code: string, secretCode: string}>(); @Output() create = new EventEmitter(); selectedItem: any; totpSettingDisplay = false; headerItem: string; totpCode: string; lists = []; constructor() { } ngOnInit() { this.lists = [ {id: 1, name: 'Email', value: this.domainMember.member.email, description: 'blabla', }, {id: 2, name: 'Phone', value: this.domainMember.member.phone, description: 'blabla', }, {id: 3, name: 'Google 2factor', value: this.domainMember.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.create.emit(this.domainMember.member); } } totpInput(e) { if ( e.target.value.length === 6 ) { this.regist.emit(e.target.value); } return; } }