2018-05-31 12:11:31 +00:00
|
|
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
2018-05-28 11:25:53 +00:00
|
|
|
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
|
|
|
import { Member } from '@overflow/commons-typescript/model/member';
|
2018-05-28 10:28:26 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-member-totp',
|
|
|
|
templateUrl: './member-totp.component.html',
|
|
|
|
})
|
|
|
|
export class MemberTotpComponent implements OnInit {
|
2018-05-28 11:25:53 +00:00
|
|
|
@Input() domainMember: DomainMember;
|
2018-05-28 10:28:26 +00:00
|
|
|
@Input() totp;
|
2018-05-31 12:11:31 +00:00
|
|
|
@Output() regist = new EventEmitter<{ member: Member, code: string, secretCode: string }>();
|
2018-05-28 11:25:53 +00:00
|
|
|
@Output() create = new EventEmitter<Member>();
|
2018-05-28 10:28:26 +00:00
|
|
|
|
|
|
|
selectedItem: any;
|
|
|
|
totpSettingDisplay = false;
|
|
|
|
headerItem: string;
|
|
|
|
|
|
|
|
totpCode: string;
|
|
|
|
|
|
|
|
lists = [];
|
|
|
|
|
|
|
|
constructor() { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.lists = [
|
2018-05-31 12:11:31 +00:00
|
|
|
{ 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', },
|
2018-05-28 10:28:26 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
on2factorConfig(event: Event, item: any) {
|
|
|
|
this.selectedItem = item;
|
|
|
|
|
|
|
|
// server totp regist member info modify
|
|
|
|
if (this.selectedItem.id === 3) {
|
|
|
|
this.headerItem = '구글 인증기 설정하기';
|
|
|
|
this.totpSettingDisplay = true;
|
2018-06-01 09:16:23 +00:00
|
|
|
// this.create.emit(this.domainMember.member);
|
2018-05-28 10:28:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
totpInput(e) {
|
2018-06-01 09:16:23 +00:00
|
|
|
if (e.target.value.length >= 6) {
|
2018-05-28 11:25:53 +00:00
|
|
|
this.regist.emit(e.target.value);
|
2018-05-28 10:28:26 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|