ing
This commit is contained in:
parent
2802c1ae17
commit
41597d406d
|
@ -1,14 +1,16 @@
|
||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
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({
|
@Component({
|
||||||
selector: 'of-member-totp',
|
selector: 'of-member-totp',
|
||||||
templateUrl: './member-totp.component.html',
|
templateUrl: './member-totp.component.html',
|
||||||
})
|
})
|
||||||
export class MemberTotpComponent implements OnInit {
|
export class MemberTotpComponent implements OnInit {
|
||||||
@Input() member;
|
@Input() domainMember: DomainMember;
|
||||||
@Input() totp;
|
@Input() totp;
|
||||||
@Output() totpRegist = new EventEmitter<{code: string, secretCode: string}>();
|
@Output() regist = new EventEmitter<{member: Member, code: string, secretCode: string}>();
|
||||||
@Output() totpCreate = new EventEmitter();
|
@Output() create = new EventEmitter<Member>();
|
||||||
|
|
||||||
selectedItem: any;
|
selectedItem: any;
|
||||||
totpSettingDisplay = false;
|
totpSettingDisplay = false;
|
||||||
|
@ -22,9 +24,9 @@ export class MemberTotpComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.lists = [
|
this.lists = [
|
||||||
{id: 1, name: 'Email', value: this.member.email, description: 'blabla', },
|
{id: 1, name: 'Email', value: this.domainMember.member.email, description: 'blabla', },
|
||||||
{id: 2, name: 'Phone', value: this.member.phone, description: 'blabla', },
|
{id: 2, name: 'Phone', value: this.domainMember.member.phone, description: 'blabla', },
|
||||||
{id: 3, name: 'Google 2factor', value: this.member.totpType, description: 'blabla', },
|
{id: 3, name: 'Google 2factor', value: this.domainMember.member.totpType, description: 'blabla', },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +37,13 @@ export class MemberTotpComponent implements OnInit {
|
||||||
if (this.selectedItem.id === 3) {
|
if (this.selectedItem.id === 3) {
|
||||||
this.headerItem = '구글 인증기 설정하기';
|
this.headerItem = '구글 인증기 설정하기';
|
||||||
this.totpSettingDisplay = true;
|
this.totpSettingDisplay = true;
|
||||||
this.totpCreate.emit();
|
this.create.emit(this.domainMember.member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
totpInput(e) {
|
totpInput(e) {
|
||||||
if ( e.target.value.length === 6 ) {
|
if ( e.target.value.length === 6 ) {
|
||||||
this.totpRegist.emit(e.target.value);
|
this.regist.emit(e.target.value);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<of-member-totp
|
<of-member-totp
|
||||||
[member]="member"
|
[domainMember]="domainMember$ | async"
|
||||||
[totp]="totp$ | async"
|
[totp]="totp$ | async"
|
||||||
(totpRegist)="onTotpRegist($event)"
|
(regist)="regist($event)"
|
||||||
(totpCreate)="onTotpCreate()"></of-member-totp>
|
(create)="create()"
|
||||||
|
>
|
||||||
|
</of-member-totp>
|
||||||
|
|
|
@ -2,52 +2,39 @@ import { Component, OnInit} from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import * as TotpStore from '../store/entity/member-totp';
|
|
||||||
import { AuthSelector } from '../store/entity/member';
|
|
||||||
import { Member, MemberTotp } from '@overflow/commons-typescript/model/member';
|
import { Member, MemberTotp } from '@overflow/commons-typescript/model/member';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
||||||
|
|
||||||
|
import * as TotpEntityStore from '../store/entity/member-totp';
|
||||||
|
import { AuthContainerSelector } from '@overflow/shared/auth/store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-member-totp-container',
|
selector: 'of-member-totp-container',
|
||||||
templateUrl: './member-totp-container.component.html',
|
templateUrl: './member-totp-container.component.html',
|
||||||
})
|
})
|
||||||
export class MemberTotpContainerComponent implements OnInit {
|
export class MemberTotpContainerComponent implements OnInit {
|
||||||
member: Member;
|
domainMember$: Observable<DomainMember>;
|
||||||
totp$: Observable<MemberTotp[]>;
|
totp$: Observable<MemberTotp[]>;
|
||||||
lists = [];
|
lists = [];
|
||||||
|
|
||||||
constructor(private activatedRoute: ActivatedRoute,
|
constructor(
|
||||||
|
private activatedRoute: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private store: Store<TotpStore.State>,
|
private store: Store<any>,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.store.select(AuthSelector.select('member')).subscribe(
|
this.domainMember$ = this.store.select(AuthContainerSelector.selectDomainMember);
|
||||||
(member: Member) => {
|
|
||||||
this.member = member;
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTotpRegist(obj: any) {
|
regist(info: {member: Member, code: string, secretCode: string}) {
|
||||||
const secretCode = 'X6AWAK573M5372NM';
|
const secretCode = 'X6AWAK573M5372NM';
|
||||||
|
|
||||||
this.store.dispatch(new TotpStore.Regist({ member: this.member, secretCode: obj.secretCode, code: obj.code }));
|
this.store.dispatch(new TotpEntityStore.Regist(info));
|
||||||
|
|
||||||
// this.store.select(AuthSelector.select('memberTotp')).subscribe(
|
|
||||||
// (memberTotp: MemberTotp) => {
|
|
||||||
//
|
|
||||||
// },
|
|
||||||
// (error) => {
|
|
||||||
// console.log(error);
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTotpCreate() {
|
create(member: Member) {
|
||||||
this.store.dispatch(new TotpStore.CreateTotp(this.member));
|
this.store.dispatch(new TotpEntityStore.CreateTotp(member));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user