totp ing
This commit is contained in:
parent
7a9ee9ed9e
commit
6b65842eec
@ -16,7 +16,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>Key & Backup Code</p>
|
<p>Key & Backup Code</p>
|
||||||
<div>{{totpMap.key}}</div>
|
<div *ngIf="totp">{{totp.key}}, {{totp.uri}}</div>
|
||||||
|
<div *ngIf="totp">
|
||||||
|
<qrcode [qrdata]="totp.uri" [size]="128" [level]="'M'"></qrcode>
|
||||||
|
</div>
|
||||||
<form fxLayout="column" fxLayoutAlign="start stretch" [formGroup]="totpForm" (ngSubmit)="totpRegistClick()">
|
<form fxLayout="column" fxLayoutAlign="start stretch" [formGroup]="totpForm" (ngSubmit)="totpRegistClick()">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
id="code" class="input"
|
id="code" class="input"
|
||||||
|
@ -25,8 +25,9 @@ import {RPCClientError} from '../../../../../../@loafer/ng-rpc/protocol';
|
|||||||
export class ConfigSettingComponent implements OnInit, AfterContentInit {
|
export class ConfigSettingComponent implements OnInit, AfterContentInit {
|
||||||
member: Member;
|
member: Member;
|
||||||
totpState$ = this.store.pipe(select(TotpSelector.select('totp')));
|
totpState$ = this.store.pipe(select(TotpSelector.select('totp')));
|
||||||
totpMap: any;
|
totp: any;
|
||||||
totpForm: FormGroup;
|
totpForm: FormGroup;
|
||||||
|
qrData:string;
|
||||||
|
|
||||||
@Input() selectedItem: any;
|
@Input() selectedItem: any;
|
||||||
@Output() close = new EventEmitter();
|
@Output() close = new EventEmitter();
|
||||||
@ -39,11 +40,16 @@ export class ConfigSettingComponent implements OnInit, AfterContentInit {
|
|||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.totpForm = this.formBuilder.group({
|
||||||
|
'code': [
|
||||||
|
[
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
this.totpState$.subscribe(
|
this.totpState$.subscribe(
|
||||||
(m: any) => {
|
(obj: any) => {
|
||||||
if (m != null) {
|
console.log(obj);
|
||||||
this.totpMap = m;
|
this.totp = obj;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
(error: RPCClientError) => {
|
(error: RPCClientError) => {
|
||||||
console.log(error.response.message);
|
console.log(error.response.message);
|
||||||
|
@ -14,8 +14,6 @@ export class MemberTotpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public createTotp(member: Member): Observable<MemberTotp[]> {
|
public createTotp(member: Member): Observable<MemberTotp[]> {
|
||||||
// Todo Store get member object
|
|
||||||
|
|
||||||
return this.rpcService.call<MemberTotp[]>('MemberTotpService.createTotp', member);
|
return this.rpcService.call<MemberTotp[]>('MemberTotpService.createTotp', member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ export function reducer(state = initialState, action: Actions): State {
|
|||||||
const keyURI = action.payload.uri;
|
const keyURI = action.payload.uri;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
totp: {key: secretKey, uri: keyURI},
|
||||||
error: null,
|
error: null,
|
||||||
pending: false,
|
pending: false,
|
||||||
secretKey: secretKey,
|
secretKey: secretKey,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { RESTClientError } from '@loafer/ng-rest/protocol';
|
import { RESTClientError } from '@loafer/ng-rest/protocol';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
|
totp: any;
|
||||||
secretKey: string;
|
secretKey: string;
|
||||||
keyURI: string;
|
keyURI: string;
|
||||||
error: RESTClientError | null;
|
error: RESTClientError | null;
|
||||||
@ -8,6 +9,7 @@ export interface State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const initialState: State = {
|
export const initialState: State = {
|
||||||
|
totp: null,
|
||||||
secretKey: null,
|
secretKey: null,
|
||||||
keyURI: null,
|
keyURI: null,
|
||||||
error: null,
|
error: null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user