@firestitch/2fa 12.11.7 → 13.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/app/modules/code-input/code-input.module.d.ts +4 -2
  2. package/esm2020/app/modules/code-input/code-input.module.mjs +38 -0
  3. package/esm2020/app/modules/code-input/components/code-input/code-input.component.mjs +37 -0
  4. package/esm2020/app/modules/defaulted/components/defaulted/defaulted.component.mjs +11 -0
  5. package/{esm2015/app/modules/defaulted/defaulted.module.js → esm2020/app/modules/defaulted/defaulted.module.mjs} +5 -5
  6. package/esm2020/app/modules/manage/components/2fa-manage/2fa-manage.component.mjs +98 -0
  7. package/esm2020/app/modules/manage/components/app/app.component.mjs +84 -0
  8. package/esm2020/app/modules/manage/components/email/email.component.mjs +79 -0
  9. package/esm2020/app/modules/manage/components/emails/emails.component.mjs +47 -0
  10. package/esm2020/app/modules/manage/components/manage-methods/manage-methods.component.mjs +125 -0
  11. package/esm2020/app/modules/manage/components/number/number.component.mjs +83 -0
  12. package/esm2020/app/modules/manage/components/numbers/numbers.component.mjs +48 -0
  13. package/esm2020/app/modules/manage/components/qr-code/qr-code.component.mjs +32 -0
  14. package/{esm2015/app/modules/manage/fs-2f-manage.module.js → esm2020/app/modules/manage/fs-2f-manage.module.mjs} +5 -5
  15. package/{esm2015/app/modules/manage/services/two-factor-manage.service.js → esm2020/app/modules/manage/services/two-factor-manage.service.mjs} +4 -4
  16. package/esm2020/app/modules/resend/components/resend/resend.component.mjs +35 -0
  17. package/{esm2015/app/modules/resend/resend.module.js → esm2020/app/modules/resend/resend.module.mjs} +5 -5
  18. package/esm2020/app/modules/verification/components/2fa-verification/2fa-verification.component.mjs +124 -0
  19. package/esm2020/app/modules/verification/components/2fa-verification-code/2fa-verification-code.component.mjs +57 -0
  20. package/esm2020/app/modules/verification/components/2fa-verification-methods/2fa-verification-methods.component.mjs +56 -0
  21. package/{esm2015/app/modules/verification/directives/2fa-verification-resend.directive.js → esm2020/app/modules/verification/directives/2fa-verification-resend.directive.mjs} +4 -4
  22. package/{esm2015/app/modules/verification/fs-2fa-verification.module.js → esm2020/app/modules/verification/fs-2fa-verification.module.mjs} +5 -5
  23. package/esm2020/app/modules/verification-methods/components/verification-methods/verification-methods.component.mjs +117 -0
  24. package/{esm2015/app/modules/verification-methods/fs-2f-verification-methods.module.js → esm2020/app/modules/verification-methods/fs-2f-verification-methods.module.mjs} +5 -5
  25. package/fesm2015/firestitch-2fa.mjs +1370 -0
  26. package/fesm2015/firestitch-2fa.mjs.map +1 -0
  27. package/fesm2020/firestitch-2fa.mjs +1356 -0
  28. package/fesm2020/firestitch-2fa.mjs.map +1 -0
  29. package/package.json +21 -8
  30. package/bundles/firestitch-2fa.umd.js +0 -1586
  31. package/bundles/firestitch-2fa.umd.js.map +0 -1
  32. package/esm2015/app/modules/code-input/code-input.module.js +0 -30
  33. package/esm2015/app/modules/code-input/components/code-input/code-input.component.js +0 -42
  34. package/esm2015/app/modules/defaulted/components/defaulted/defaulted.component.js +0 -16
  35. package/esm2015/app/modules/manage/components/2fa-manage/2fa-manage.component.js +0 -104
  36. package/esm2015/app/modules/manage/components/app/app.component.js +0 -88
  37. package/esm2015/app/modules/manage/components/email/email.component.js +0 -83
  38. package/esm2015/app/modules/manage/components/emails/emails.component.js +0 -50
  39. package/esm2015/app/modules/manage/components/manage-methods/manage-methods.component.js +0 -128
  40. package/esm2015/app/modules/manage/components/number/number.component.js +0 -87
  41. package/esm2015/app/modules/manage/components/numbers/numbers.component.js +0 -51
  42. package/esm2015/app/modules/manage/components/qr-code/qr-code.component.js +0 -37
  43. package/esm2015/app/modules/resend/components/resend/resend.component.js +0 -40
  44. package/esm2015/app/modules/verification/components/2fa-verification/2fa-verification.component.js +0 -130
  45. package/esm2015/app/modules/verification/components/2fa-verification-code/2fa-verification-code.component.js +0 -63
  46. package/esm2015/app/modules/verification/components/2fa-verification-methods/2fa-verification-methods.component.js +0 -61
  47. package/esm2015/app/modules/verification-methods/components/verification-methods/verification-methods.component.js +0 -121
  48. package/fesm2015/firestitch-2fa.js +0 -1421
  49. package/fesm2015/firestitch-2fa.js.map +0 -1
  50. /package/{esm2015/app/enums/index.js → esm2020/app/enums/index.mjs} +0 -0
  51. /package/{esm2015/app/enums/verification-method-type.enum.js → esm2020/app/enums/verification-method-type.enum.mjs} +0 -0
  52. /package/{esm2015/app/interfaces/index.js → esm2020/app/interfaces/index.mjs} +0 -0
  53. /package/{esm2015/app/interfaces/verification-method.interface.js → esm2020/app/interfaces/verification-method.interface.mjs} +0 -0
  54. /package/{esm2015/app/modules/code-input/components/code-input/index.js → esm2020/app/modules/code-input/components/code-input/index.mjs} +0 -0
  55. /package/{esm2015/app/modules/code-input/index.js → esm2020/app/modules/code-input/index.mjs} +0 -0
  56. /package/{esm2015/app/modules/defaulted/components/defaulted/index.js → esm2020/app/modules/defaulted/components/defaulted/index.mjs} +0 -0
  57. /package/{esm2015/app/modules/manage/components/2fa-manage/index.js → esm2020/app/modules/manage/components/2fa-manage/index.mjs} +0 -0
  58. /package/{esm2015/app/modules/manage/components/app/index.js → esm2020/app/modules/manage/components/app/index.mjs} +0 -0
  59. /package/{esm2015/app/modules/manage/components/email/index.js → esm2020/app/modules/manage/components/email/index.mjs} +0 -0
  60. /package/{esm2015/app/modules/manage/components/emails/index.js → esm2020/app/modules/manage/components/emails/index.mjs} +0 -0
  61. /package/{esm2015/app/modules/manage/components/manage-methods/index.js → esm2020/app/modules/manage/components/manage-methods/index.mjs} +0 -0
  62. /package/{esm2015/app/modules/manage/components/number/index.js → esm2020/app/modules/manage/components/number/index.mjs} +0 -0
  63. /package/{esm2015/app/modules/manage/components/numbers/index.js → esm2020/app/modules/manage/components/numbers/index.mjs} +0 -0
  64. /package/{esm2015/app/modules/manage/components/qr-code/index.js → esm2020/app/modules/manage/components/qr-code/index.mjs} +0 -0
  65. /package/{esm2015/app/modules/manage/services/index.js → esm2020/app/modules/manage/services/index.mjs} +0 -0
  66. /package/{esm2015/app/modules/resend/components/resend/index.js → esm2020/app/modules/resend/components/resend/index.mjs} +0 -0
  67. /package/{esm2015/app/modules/verification/directives/index.js → esm2020/app/modules/verification/directives/index.mjs} +0 -0
  68. /package/{esm2015/app/modules/verification-methods/components/verification-methods/index.js → esm2020/app/modules/verification-methods/components/verification-methods/index.mjs} +0 -0
  69. /package/{esm2015/app/modules/verification-methods/index.js → esm2020/app/modules/verification-methods/index.mjs} +0 -0
  70. /package/{esm2015/firestitch-2fa.js → esm2020/firestitch-2fa.mjs} +0 -0
  71. /package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
@@ -1,1421 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Inject, EventEmitter, ViewChild, Input, Output, NgModule, Directive, HostListener, Injectable } from '@angular/core';
3
- import * as i8 from '@angular/forms';
4
- import { ControlContainer, NgForm, FormsModule } from '@angular/forms';
5
- import * as i9$1 from '@angular/common';
6
- import { CommonModule } from '@angular/common';
7
- import * as i4 from '@angular/material/icon';
8
- import { MatIconModule } from '@angular/material/icon';
9
- import * as i5 from '@angular/material/radio';
10
- import { MatRadioModule } from '@angular/material/radio';
11
- import * as i6 from '@angular/material/button';
12
- import { MatButtonModule } from '@angular/material/button';
13
- import * as i5$1 from '@angular/material/form-field';
14
- import { MatFormFieldModule } from '@angular/material/form-field';
15
- import * as i11$1 from '@angular/material/input';
16
- import { MatInputModule } from '@angular/material/input';
17
- import * as i6$1 from '@angular/material/checkbox';
18
- import { MatCheckboxModule } from '@angular/material/checkbox';
19
- import * as i9 from '@firestitch/form';
20
- import { FsFormModule, FsFormDirective } from '@firestitch/form';
21
- import * as i11 from '@firestitch/skeleton';
22
- import { FsSkeletonModule } from '@firestitch/skeleton';
23
- import * as i3$1 from '@firestitch/radiogroup';
24
- import { FsRadioGroupModule } from '@firestitch/radiogroup';
25
- import * as i3 from '@firestitch/dialog';
26
- import { FsDialogModule } from '@firestitch/dialog';
27
- import { Subject, of, BehaviorSubject } from 'rxjs';
28
- import * as i2 from '@firestitch/message';
29
- import { tap, takeUntil, finalize, filter, switchMap, map } from 'rxjs/operators';
30
- import * as i1 from '@angular/material/dialog';
31
- import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
32
- import * as i1$1 from '@firestitch/code-input';
33
- import { FsCodeInputComponent, FsCodeInputModule } from '@firestitch/code-input';
34
- import * as i8$1 from '@firestitch/phone';
35
- import { FsPhoneModule } from '@firestitch/phone';
36
- import * as i1$2 from '@angular/material/progress-spinner';
37
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
38
- import * as i4$1 from '@firestitch/country';
39
- import { FsCountryModule } from '@firestitch/country';
40
- import * as i3$2 from '@firestitch/label';
41
- import { FsLabelModule } from '@firestitch/label';
42
- import * as i2$1 from '@firestitch/list';
43
- import { FsListComponent, FsListModule } from '@firestitch/list';
44
- import * as i1$3 from '@firestitch/prompt';
45
- import QRCode from 'qrcode';
46
-
47
- var VerificationMethodType;
48
- (function (VerificationMethodType) {
49
- VerificationMethodType["Sms"] = "sms";
50
- VerificationMethodType["Email"] = "email";
51
- VerificationMethodType["App"] = "app";
52
- })(VerificationMethodType || (VerificationMethodType = {}));
53
-
54
- class Fs2faVerificationMethodsComponent {
55
- constructor(_dialogData, _dialogRef) {
56
- this._dialogData = _dialogData;
57
- this._dialogRef = _dialogRef;
58
- this.verificationMethodType = VerificationMethodType;
59
- this.setVerificationMethod = () => {
60
- return this._selectVerificationMethod(this.verificationMethod)
61
- .pipe(tap((method) => {
62
- this._dialogRef.close(method);
63
- }));
64
- };
65
- this._selectVerificationMethod = _dialogData.selectVerificationMethod;
66
- this._setActiveMethod();
67
- this._initMethods(_dialogData.verificationMethods);
68
- }
69
- compareWith(o1, o2) {
70
- return o1 && o2 && o1.id === o2.id;
71
- }
72
- _setActiveMethod() {
73
- var _a;
74
- this.verificationMethod = (_a = this._dialogData) === null || _a === void 0 ? void 0 : _a.verificationMethod;
75
- }
76
- _initMethods(verificationMethods) {
77
- this.verificationMethods = verificationMethods
78
- .reduce((acc, method) => {
79
- if (!acc[method.type]) {
80
- acc[method.type] = [];
81
- }
82
- acc[method.type].push(method);
83
- return acc;
84
- }, {});
85
- }
86
- }
87
- Fs2faVerificationMethodsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
88
- Fs2faVerificationMethodsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: Fs2faVerificationMethodsComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>\n Verification Methods\n </h1>\n <form fsForm [submit]=\"setVerificationMethod\" [dirtySubmitButton]=\"false\">\n <mat-dialog-content>\n <ng-container>\n <fs-radio-group [(ngModel)]=\"verificationMethod\" name=\"method\" [compareWith]=\"compareWith\">\n <ng-container *ngFor=\"let methodMap of verificationMethods | keyvalue\">\n <div class=\"method\">\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n textsms\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Text Message</div>\n <div class=\"method-subtitle\">\n Send verification code to a mobile number\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n mail\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Email</div>\n <div class=\"method-subtitle\">\n Send verification code to an email address\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.App\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n phone_iphone\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Authenticator App</div>\n <div class=\"method-subtitle\">\n Send verification code to your authenticator app\n </div>\n </div>\n </div>\n </ng-container> \n </ng-container>\n\n <mat-radio-button class=\"method-item\" *ngFor=\"let method of methodMap.value\" [value]=\"method\">\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n {{ method.phoneNumber }}\n </ng-container>\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n {{ method.email }}\n </ng-container>\n <ng-container *ngSwitchCase=\"verificationMethodType.App\">\n Authenticator App\n </ng-container> \n </ng-container>\n </mat-radio-button>\n </div>\n </ng-container>\n </fs-radio-group>\n </ng-container>\n </mat-dialog-content>\n <mat-dialog-actions>\n <div class=\"actions\">\n <button mat-button type=\"submit\" color=\"primary\">Next</button>\n <button mat-button type=\"button\" [mat-dialog-close]=\"null\">Cancel</button>\n </div>\n </mat-dialog-actions>\n </form>\n</fs-dialog>\n", styles: [".method{display:block;margin-bottom:20px}.method .method-header{display:flex;align-items:flex-start}.method .method-header .method-name{margin-left:10px}.method .method-header .method-name .method-title{font-size:14px;font-weight:400}.method .method-header .method-name .method-subtitle{font-size:12px;color:#a3a3a3}.method .method-item{display:block;margin:10px 0 0 35px}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i3$1.FsRadioGroupComponent, selector: "fs-radio-group", inputs: ["orientation", "label", "name", "disabled", "radioPosition", "compareWith", "required"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i5.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i8.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i9.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i9.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], pipes: { "keyvalue": i9$1.KeyValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsComponent, decorators: [{
90
- type: Component,
91
- args: [{
92
- templateUrl: './2fa-verification-methods.component.html',
93
- styleUrls: ['./2fa-verification-methods.component.scss'],
94
- changeDetection: ChangeDetectionStrategy.OnPush,
95
- }]
96
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
97
- type: Inject,
98
- args: [MAT_DIALOG_DATA]
99
- }] }, { type: i1.MatDialogRef }]; } });
100
-
101
- class CodeInputComponent {
102
- constructor() {
103
- this.codeCompleted = new EventEmitter();
104
- this.codeChanged = new EventEmitter();
105
- }
106
- ngOnInit() {
107
- if (!this.codeLength) {
108
- this.codeLength = 6;
109
- }
110
- }
111
- focus() {
112
- this.codeInput.focusOnField(0);
113
- }
114
- }
115
- CodeInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
116
- CodeInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CodeInputComponent, selector: "app-code-input", inputs: { codeLength: "codeLength", code: "code" }, outputs: { codeCompleted: "codeCompleted", codeChanged: "codeChanged" }, viewQueries: [{ propertyName: "codeInput", first: true, predicate: FsCodeInputComponent, descendants: true }], ngImport: i0, template: "<fs-code-input\n [codeLength]=\"codeLength\"\n [ngModel]=\"code\"\n name=\"code\"\n [isPrevFocusableAfterClearing]=\"false\"\n (completed)=\"codeCompleted.emit($event)\"\n (ngModelChange)=\"codeChanged.emit($event)\">\n</fs-code-input>\n", styles: ["code-input{--item-spacing: 10px;--item-height: 20px;--item-border: none;--item-border-bottom: 2px solid #949494;--item-border-has-value: none;--item-border-bottom-has-value: 2px solid #949494;--item-border-focused: none;--item-border-bottom-focused: 2px solid #0061AF;--item-shadow-focused: none;--item-border-radius: 0px}code-input ::ng-deep span:first-child{padding-left:0!important}code-input ::ng-deep span:last-child{padding-right:0!important}code-input ::ng-deep input{font-size:20px!important;height:40px!important;padding:0!important}\n"], components: [{ type: i1$1.FsCodeInputComponent, selector: "fs-code-input", inputs: ["disabled", "codeLength", "inputType", "inputMode", "isCharsCode", "isCodeHidden", "autocapitalize", "initialFocusField", "isPrevFocusableAfterClearing", "isFocusingOnLastByClickIfFilled"], outputs: ["changed", "completed"] }], directives: [{ type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputComponent, decorators: [{
118
- type: Component,
119
- args: [{
120
- selector: 'app-code-input',
121
- templateUrl: './code-input.component.html',
122
- styleUrls: ['./code-input.component.scss'],
123
- changeDetection: ChangeDetectionStrategy.OnPush,
124
- }]
125
- }], propDecorators: { codeInput: [{
126
- type: ViewChild,
127
- args: [FsCodeInputComponent]
128
- }], codeLength: [{
129
- type: Input
130
- }], code: [{
131
- type: Input
132
- }], codeCompleted: [{
133
- type: Output
134
- }], codeChanged: [{
135
- type: Output
136
- }] } });
137
-
138
- class Fs2faVerificationCodeComponent {
139
- constructor(_form) {
140
- this._form = _form;
141
- this.codeChanged = new EventEmitter();
142
- this.codeCompleted = new EventEmitter();
143
- this.VerificationMethodType = VerificationMethodType;
144
- }
145
- codeChange(code) {
146
- this.code = code;
147
- this.codeChanged.emit(this.code);
148
- this._form.dirty();
149
- }
150
- focus() {
151
- this.codeInputComponent.focus();
152
- }
153
- }
154
- Fs2faVerificationCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationCodeComponent, deps: [{ token: i9.FsFormDirective }], target: i0.ɵɵFactoryTarget.Component });
155
- Fs2faVerificationCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: Fs2faVerificationCodeComponent, selector: "fs-2fa-verification-code", inputs: { type: "type", recipient: "recipient", codeLength: "codeLength", code: "code" }, outputs: { codeChanged: "codeChanged", codeCompleted: "codeCompleted" }, viewQueries: [{ propertyName: "codeInputComponent", first: true, predicate: CodeInputComponent, descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"type === VerificationMethodType.Sms\">\n <p class=\"description\">\n A text message with a verification code was just sent to <span style=\"white-space: nowrap;\">{{ recipient }}</span> to verify it's you.\n </p>\n\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"type === VerificationMethodType.Email\">\n <p class=\"description\">\n An email with a verification code was just sent to {{ recipient }} to verify it's you.\n </p>\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"type === VerificationMethodType.App\">\n <p class=\"description\">\n Enter the verification code generated by your 2 factor authenticator app to verify it's you.\n </p>\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n<ng-template #input> \n <app-code-input \n [code]=\"code\"\n [codeLength]=\"codeLength\"\n (codeChanged)=\"codeChange($event)\"\n (codeCompleted)=\"codeCompleted.emit()\">\n </app-code-input> \n</ng-template> ", styles: ["mat-form-field{width:100%}mat-form-field ::ng-deep .mat-form-field-subscript-wrapper{min-height:unset!important}mat-form-field ::ng-deep .mat-form-field-subscript-wrapper .fs-form-error{padding-bottom:5px}app-code-input{margin-bottom:5px}\n"], components: [{ type: CodeInputComponent, selector: "app-code-input", inputs: ["codeLength", "code"], outputs: ["codeCompleted", "codeChanged"] }], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], viewProviders: [
156
- {
157
- provide: ControlContainer,
158
- useExisting: NgForm,
159
- },
160
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationCodeComponent, decorators: [{
162
- type: Component,
163
- args: [{
164
- selector: 'fs-2fa-verification-code',
165
- templateUrl: './2fa-verification-code.component.html',
166
- styleUrls: ['./2fa-verification-code.component.scss'],
167
- changeDetection: ChangeDetectionStrategy.OnPush,
168
- viewProviders: [
169
- {
170
- provide: ControlContainer,
171
- useExisting: NgForm,
172
- },
173
- ],
174
- }]
175
- }], ctorParameters: function () { return [{ type: i9.FsFormDirective }]; }, propDecorators: { codeInputComponent: [{
176
- type: ViewChild,
177
- args: [CodeInputComponent]
178
- }], type: [{
179
- type: Input
180
- }], recipient: [{
181
- type: Input
182
- }], codeLength: [{
183
- type: Input
184
- }], code: [{
185
- type: Input
186
- }], codeChanged: [{
187
- type: Output
188
- }], codeCompleted: [{
189
- type: Output
190
- }] } });
191
-
192
- class Fs2faVerificationComponent {
193
- constructor(_cdRef, _dialog, _message) {
194
- this._cdRef = _cdRef;
195
- this._dialog = _dialog;
196
- this._message = _message;
197
- this.showTrustedDevice = true;
198
- this.trustDevice = true;
199
- this.formatRecipient = false;
200
- this.verified = new EventEmitter();
201
- this.codeChanged = new EventEmitter();
202
- this.codeCompleted = new EventEmitter();
203
- this.trustDeviceChange = new EventEmitter();
204
- this.code = '';
205
- this.VerificationMethodType = VerificationMethodType;
206
- this._destroy$ = new Subject();
207
- }
208
- get recipient() {
209
- if (this.verificationMethod.type === VerificationMethodType.Email) {
210
- return this.verificationMethod.email;
211
- }
212
- if (this.verificationMethod.type === VerificationMethodType.Sms) {
213
- return this.verificationMethod.phoneNumber;
214
- }
215
- }
216
- ngOnInit() {
217
- this.codeChanged
218
- .pipe(takeUntil(this._destroy$))
219
- .subscribe((code) => {
220
- this.code = code;
221
- });
222
- }
223
- ngOnDestroy() {
224
- this._destroy$.next();
225
- this._destroy$.complete();
226
- }
227
- ngAfterViewInit() {
228
- this.verificationCodeComponent.focus();
229
- }
230
- resendCode() {
231
- return this.resend()
232
- .pipe(tap(() => {
233
- this.code = '';
234
- this._message.success('Resent Code');
235
- }), finalize(() => {
236
- this.verificationCodeComponent.focus();
237
- }));
238
- }
239
- showVerificationMethods() {
240
- this.getVerificationMethods()
241
- .subscribe((verificationMethods) => {
242
- this._dialog.open(Fs2faVerificationMethodsComponent, {
243
- data: {
244
- verificationMethod: this.verificationMethod,
245
- verificationMethods,
246
- selectVerificationMethod: this.selectVerificationMethod,
247
- }
248
- })
249
- .afterClosed()
250
- .pipe(filter((verificationMethod) => !!verificationMethod))
251
- .subscribe((verificationMethod) => {
252
- this.verificationMethod = verificationMethod;
253
- this.code = '';
254
- this._cdRef.markForCheck();
255
- setTimeout(() => {
256
- this.verificationCodeComponent.focus();
257
- });
258
- });
259
- });
260
- }
261
- }
262
- Fs2faVerificationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i3.FsDialog }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
263
- Fs2faVerificationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: Fs2faVerificationComponent, selector: "fs-2fa-verification", inputs: { verificationMethod: "verificationMethod", resend: "resend", showTrustedDevice: "showTrustedDevice", trustDevice: "trustDevice", codeLength: "codeLength", trustDays: "trustDays", formatRecipient: "formatRecipient", getVerificationMethods: "getVerificationMethods", selectVerificationMethod: "selectVerificationMethod" }, outputs: { verified: "verified", codeChanged: "codeChanged", codeCompleted: "codeCompleted", trustDeviceChange: "trustDeviceChange" }, viewQueries: [{ propertyName: "verificationCodeComponent", first: true, predicate: Fs2faVerificationCodeComponent, descendants: true }], ngImport: i0, template: "<div class=\"code-container\">\n <fs-2fa-verification-code\n [recipient]=\"(formatRecipient && verificationMethod.type === VerificationMethodType.Sms) ? (recipient | fsPhone) : recipient\"\n [type]=\"verificationMethod.type\"\n [code]=\"code\"\n [codeLength]=\"codeLength\"\n (codeChanged)=\"codeChanged.emit($event)\"\n (codeCompleted)=\"codeCompleted.emit()\">\n </fs-2fa-verification-code>\n</div>\n\n<div class=\"additional\">\n <div \n class=\"trust-device\"\n *ngIf=\"showTrustedDevice\">\n <mat-checkbox\n name=\"trust-device\"\n [(ngModel)]=\"trustDevice\"\n (ngModelChange)=\"trustDeviceChange.emit($event)\">\n <div class=\"small\">\n Bypass verification \n <ng-container *ngIf=\"trustDays\">for {{trustDays}} days</ng-container> \n <ng-container *ngIf=\"!trustDays\">for future signins</ng-container> \n unless cookies are cleared\n </div>\n </mat-checkbox>\n </div>\n</div>", styles: [":host ::ng-deep .mat-checkbox{margin:2px 0}:host ::ng-deep .mat-checkbox .mat-checkbox-label{line-height:normal}:host ::ng-deep .mat-checkbox .mat-checkbox-layout{white-space:normal}.code-container{text-align:center}.additional{display:flex;justify-content:space-between;align-items:center;margin:4px 0 5px}.additional small{color:inherit}.additional .resend{cursor:pointer;text-transform:none}.additional .resend mat-spinner{display:inline-block;vertical-align:middle}\n"], components: [{ type: Fs2faVerificationCodeComponent, selector: "fs-2fa-verification-code", inputs: ["type", "recipient", "codeLength", "code"], outputs: ["codeChanged", "codeCompleted"] }, { type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }], pipes: { "fsPhone": i8$1.FsPhonePipe }, viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationComponent, decorators: [{
265
- type: Component,
266
- args: [{
267
- selector: 'fs-2fa-verification',
268
- templateUrl: './2fa-verification.component.html',
269
- styleUrls: ['./2fa-verification.component.scss'],
270
- changeDetection: ChangeDetectionStrategy.OnPush,
271
- viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],
272
- }]
273
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i3.FsDialog }, { type: i2.FsMessage }]; }, propDecorators: { verificationCodeComponent: [{
274
- type: ViewChild,
275
- args: [Fs2faVerificationCodeComponent]
276
- }], verificationMethod: [{
277
- type: Input
278
- }], resend: [{
279
- type: Input
280
- }], showTrustedDevice: [{
281
- type: Input
282
- }], trustDevice: [{
283
- type: Input
284
- }], codeLength: [{
285
- type: Input
286
- }], trustDays: [{
287
- type: Input
288
- }], formatRecipient: [{
289
- type: Input
290
- }], getVerificationMethods: [{
291
- type: Input
292
- }], selectVerificationMethod: [{
293
- type: Input
294
- }], verified: [{
295
- type: Output
296
- }], codeChanged: [{
297
- type: Output
298
- }], codeCompleted: [{
299
- type: Output
300
- }], trustDeviceChange: [{
301
- type: Output
302
- }] } });
303
-
304
- class CodeInputModule {
305
- }
306
- CodeInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
307
- CodeInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputModule, declarations: [CodeInputComponent], imports: [FormsModule,
308
- FsCodeInputModule], exports: [CodeInputComponent] });
309
- CodeInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputModule, imports: [[
310
- FormsModule,
311
- FsCodeInputModule,
312
- ]] });
313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CodeInputModule, decorators: [{
314
- type: NgModule,
315
- args: [{
316
- imports: [
317
- FormsModule,
318
- FsCodeInputModule,
319
- ],
320
- declarations: [
321
- CodeInputComponent,
322
- ],
323
- exports: [
324
- CodeInputComponent,
325
- ],
326
- }]
327
- }] });
328
-
329
- class ResendComponent {
330
- constructor(_cdRef) {
331
- this._cdRef = _cdRef;
332
- this.resendInProgress = false;
333
- this._destroy$ = new Subject();
334
- }
335
- resendClick() {
336
- this.resendInProgress = true;
337
- this.resend()
338
- .pipe(finalize(() => {
339
- this.resendInProgress = false;
340
- this._cdRef.markForCheck();
341
- }), takeUntil(this._destroy$))
342
- .subscribe();
343
- }
344
- ngOnDestroy() {
345
- this._destroy$.next();
346
- this._destroy$.complete();
347
- }
348
- }
349
- ResendComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
350
- ResendComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ResendComponent, selector: "app-resend", inputs: { resend: "resend" }, ngImport: i0, template: "<ng-container *ngIf=\"!resendInProgress else sending\">\n Didn't receive a code? <a (click)=\"resendClick()\">Resend</a>\n</ng-container>\n<ng-template #sending>\n <div class=\"sending\">\n <mat-spinner [diameter]=\"12\"></mat-spinner> Sending\n </div>\n</ng-template>\n\n", styles: ["small{color:inherit}.sending{display:inline-flex;align-items:center}.sending mat-spinner{margin-right:2px}\n"], components: [{ type: i1$2.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendComponent, decorators: [{
352
- type: Component,
353
- args: [{
354
- selector: 'app-resend',
355
- templateUrl: './resend.component.html',
356
- styleUrls: ['./resend.component.scss'],
357
- changeDetection: ChangeDetectionStrategy.OnPush,
358
- }]
359
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { resend: [{
360
- type: Input
361
- }] } });
362
-
363
- class ResendModule {
364
- }
365
- ResendModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
366
- ResendModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendModule, declarations: [ResendComponent], imports: [CommonModule,
367
- MatProgressSpinnerModule], exports: [ResendComponent] });
368
- ResendModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendModule, imports: [[
369
- CommonModule,
370
- MatProgressSpinnerModule,
371
- ]] });
372
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ResendModule, decorators: [{
373
- type: NgModule,
374
- args: [{
375
- imports: [
376
- CommonModule,
377
- MatProgressSpinnerModule,
378
- ],
379
- declarations: [
380
- ResendComponent,
381
- ],
382
- exports: [
383
- ResendComponent,
384
- ],
385
- }]
386
- }] });
387
-
388
- class Fs2faVerificationResendDirective {
389
- constructor(_button) {
390
- this._button = _button;
391
- }
392
- click() {
393
- this._button.disabled = true;
394
- this.verification.resendCode()
395
- .pipe(finalize(() => this._button.disabled = false))
396
- .subscribe();
397
- }
398
- }
399
- Fs2faVerificationResendDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationResendDirective, deps: [{ token: i6.MatButton }], target: i0.ɵɵFactoryTarget.Directive });
400
- Fs2faVerificationResendDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: Fs2faVerificationResendDirective, selector: "[fs2faVerificationResend]", inputs: { verification: ["fs2faVerificationResend", "verification"] }, host: { listeners: { "click": "click()" } }, ngImport: i0 });
401
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationResendDirective, decorators: [{
402
- type: Directive,
403
- args: [{
404
- selector: '[fs2faVerificationResend]',
405
- }]
406
- }], ctorParameters: function () { return [{ type: i6.MatButton }]; }, propDecorators: { verification: [{
407
- type: Input,
408
- args: ['fs2faVerificationResend']
409
- }], click: [{
410
- type: HostListener,
411
- args: ['click']
412
- }] } });
413
-
414
- class Fs2faVerificationModule {
415
- }
416
- Fs2faVerificationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
417
- Fs2faVerificationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationModule, declarations: [Fs2faVerificationComponent,
418
- Fs2faVerificationCodeComponent,
419
- Fs2faVerificationMethodsComponent,
420
- Fs2faVerificationResendDirective], imports: [CommonModule,
421
- FormsModule,
422
- MatFormFieldModule,
423
- MatInputModule,
424
- MatButtonModule,
425
- MatIconModule,
426
- MatRadioModule,
427
- MatCheckboxModule,
428
- FsFormModule,
429
- FsRadioGroupModule,
430
- FsDialogModule,
431
- FsSkeletonModule,
432
- FsPhoneModule,
433
- FsSkeletonModule,
434
- ResendModule,
435
- CodeInputModule], exports: [Fs2faVerificationComponent,
436
- Fs2faVerificationResendDirective] });
437
- Fs2faVerificationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationModule, providers: [], imports: [[
438
- CommonModule,
439
- FormsModule,
440
- MatFormFieldModule,
441
- MatInputModule,
442
- MatButtonModule,
443
- MatIconModule,
444
- MatRadioModule,
445
- MatCheckboxModule,
446
- FsFormModule,
447
- FsRadioGroupModule,
448
- FsDialogModule,
449
- FsSkeletonModule,
450
- FsPhoneModule,
451
- FsSkeletonModule,
452
- ResendModule,
453
- CodeInputModule,
454
- ]] });
455
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationModule, decorators: [{
456
- type: NgModule,
457
- args: [{
458
- imports: [
459
- CommonModule,
460
- FormsModule,
461
- MatFormFieldModule,
462
- MatInputModule,
463
- MatButtonModule,
464
- MatIconModule,
465
- MatRadioModule,
466
- MatCheckboxModule,
467
- FsFormModule,
468
- FsRadioGroupModule,
469
- FsDialogModule,
470
- FsSkeletonModule,
471
- FsPhoneModule,
472
- FsSkeletonModule,
473
- ResendModule,
474
- CodeInputModule,
475
- ],
476
- declarations: [
477
- Fs2faVerificationComponent,
478
- Fs2faVerificationCodeComponent,
479
- Fs2faVerificationMethodsComponent,
480
- Fs2faVerificationResendDirective,
481
- ],
482
- exports: [
483
- Fs2faVerificationComponent,
484
- Fs2faVerificationResendDirective,
485
- ],
486
- providers: [],
487
- }]
488
- }] });
489
-
490
- class DefaultedComponent {
491
- }
492
- DefaultedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefaultedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
493
- DefaultedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DefaultedComponent, selector: "app-defaulted", ngImport: i0, template: "<span>Default</span>", styles: ["span{font-size:75%;background-color:#02a7f0;padding:2px 4px;border-radius:4px;color:#fff}:host{display:flex}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
494
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefaultedComponent, decorators: [{
495
- type: Component,
496
- args: [{
497
- selector: 'app-defaulted',
498
- templateUrl: './defaulted.component.html',
499
- styleUrls: ['./defaulted.component.scss'],
500
- changeDetection: ChangeDetectionStrategy.OnPush,
501
- }]
502
- }] });
503
-
504
- class DefautledModule {
505
- }
506
- DefautledModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefautledModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
507
- DefautledModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefautledModule, declarations: [DefaultedComponent], exports: [DefaultedComponent] });
508
- DefautledModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefautledModule });
509
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DefautledModule, decorators: [{
510
- type: NgModule,
511
- args: [{
512
- declarations: [
513
- DefaultedComponent,
514
- ],
515
- exports: [DefaultedComponent],
516
- }]
517
- }] });
518
-
519
- class QrCodeComponent {
520
- constructor(_cdRef) {
521
- this._cdRef = _cdRef;
522
- }
523
- ngOnInit() {
524
- QRCode.toDataURL(this.value, {
525
- errorCorrectionLevel: 'H',
526
- width: 300,
527
- height: 300,
528
- })
529
- .then((url) => {
530
- this.image = url;
531
- this._cdRef.markForCheck();
532
- })
533
- .catch((err) => {
534
- console.error(err);
535
- });
536
- }
537
- }
538
- QrCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QrCodeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
539
- QrCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: QrCodeComponent, selector: "app-qr-code", inputs: { value: "value" }, ngImport: i0, template: "<ng-container *ngIf=\"image\">\n <img [src]=\"image\">\n</ng-container>", styles: ["img{display:flex;margin:auto}\n"], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
540
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QrCodeComponent, decorators: [{
541
- type: Component,
542
- args: [{
543
- selector: 'app-qr-code',
544
- templateUrl: './qr-code.component.html',
545
- styleUrls: ['./qr-code.component.scss'],
546
- changeDetection: ChangeDetectionStrategy.OnPush,
547
- }]
548
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { value: [{
549
- type: Input
550
- }] } });
551
-
552
- class AppComponent {
553
- constructor(_data, _dialogRef, _cdRef, _message) {
554
- this._data = _data;
555
- this._dialogRef = _dialogRef;
556
- this._cdRef = _cdRef;
557
- this._message = _message;
558
- this.mode = 'qr-code';
559
- this.verify = () => {
560
- return this.twoFactorManageService.verificationMethodVerify$(this.code, true)
561
- .pipe(switchMap(() => {
562
- return this.default && this.twoFactorManageService.verificationMethodDefault$ ?
563
- this.twoFactorManageService.verificationMethodDefault$(this.verificationMethod) :
564
- of(true);
565
- }), tap(() => {
566
- this._message.success('Created app authenticator verification method');
567
- this._dialogRef.close(true);
568
- }));
569
- };
570
- }
571
- ngOnInit() {
572
- this.twoFactorManageService = this._data.twoFactorManageService;
573
- this.accountId = this._data.accountId;
574
- this.default = !this.twoFactorManageService.hasVerificationMethods;
575
- }
576
- appTypeGoogle() {
577
- this.appTypeSelect('google');
578
- }
579
- appTypeAuthy() {
580
- this.appTypeSelect('authy');
581
- }
582
- appTypeSelect(appType) {
583
- this.appType = appType;
584
- this.twoFactorManageService.verificationMethodCreate$({
585
- type: VerificationMethodType.App,
586
- })
587
- .subscribe((verificationMethod) => {
588
- this.verificationMethod = verificationMethod;
589
- this.qrCodeUrl = verificationMethod.qrCodeUrl;
590
- this._cdRef.markForCheck();
591
- });
592
- }
593
- codeCompleted() {
594
- this.form.triggerSubmit();
595
- }
596
- codeChanged(code) {
597
- this.code = code;
598
- this.form.dirty();
599
- }
600
- next() {
601
- this.mode = 'code-input';
602
- }
603
- }
604
- AppComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AppComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.ChangeDetectorRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
605
- AppComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AppComponent, selector: "ng-component", viewQueries: [{ propertyName: "form", first: true, predicate: FsFormDirective, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"verify\">\n <fs-dialog>\n <h1 mat-dialog-title>Authenticator App Setup</h1>\n <mat-dialog-content>\n\n <div *ngIf=\"mode === 'qr-code'\" class=\"qr-code\">\n <ng-container *ngIf=\"appType\">\n <ol>\n <li>\n <ng-container *ngIf=\"appType === 'authy'\">\n Install the Authy Authenticator App from the <a href=\"https://apps.apple.com/us/app/authy/id494168017\" target=\"_blank\">App Store</a> or\n the <a href=\"https://play.google.com/store/apps/details?id=com.authy.authy\" target=\"_blank\">Google Play Store</a>.\n </ng-container>\n\n <ng-container *ngIf=\"appType === 'google'\">\n Install the Google Authenticator App from the <a href=\"https://apps.apple.com/us/app/google-authenticator/id388497605\" target=\"_blank\">App Store</a> or\n the <a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en_US&gl=US\" target=\"_blank\">Google Play Store</a>.\n </ng-container>\n </li>\n <ng-container *ngIf=\"appType === 'authy'\">\n <li>\n Open the Authy app and select <b>Add Account</b>.\n </li>\n <li>\n Select <b>Scan QR Code</b> and scan the QR code below.\n </li>\n </ng-container> \n <ng-container *ngIf=\"appType === 'google'\">\n <li>\n Open the Google Authentictor app and click the <b>Plus icon</b> in the lower right corner.\n </li>\n <li>\n Select <b>Scan a QR code</b> and scan the QR code below.\n </li>\n </ng-container>\n </ol>\n\n <ng-container *fsSkeleton=\"qrCodeUrl\">\n <app-qr-code\n [value]=\"qrCodeUrl\">\n </app-qr-code>\n </ng-container>\n </ng-container>\n\n <div class=\"app-types\" *ngIf=\"!appType\">\n <p>Select the Authenticator App you prefer</p>\n\n <div class=\"row\">\n <span>\n <a (click)=\"appTypeAuthy()\">\n <svg width=\"50\" height=\"50\" viewBox=\"0 0 256 256\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMidYMid\"><path d=\"M256 127.998C256 198.696 198.694 256 127.997 256 57.304 256 0 198.696 0 127.998 0 57.305 57.304 0 127.997 0 198.694 0 256 57.305 256 127.998z\" fill=\"#EC1C24\"/><path d=\"M117.024 100.89l30.691 30.68c4.43 4.436 11.623 4.436 16.064 0 4.431-4.435 4.441-11.622 0-16.058L133.086 84.82C111.125 62.854 75.631 62.5 53.204 83.704a9.536 9.536 0 0 0-.605.548c-.098.098-.178.202-.275.29-.1.096-.202.182-.297.278-.194.193-.371.396-.54.597-21.215 22.437-20.85 57.932 1.113 79.897L83.292 196c4.44 4.433 11.623 4.433 16.062 0 4.442-4.437 4.442-11.633.011-16.06l-30.693-30.691c-13.398-13.393-13.488-35.129-.278-48.637 13.506-13.21 35.23-13.114 48.63.279zm39.612-40.873c-4.435 4.437-4.435 11.623.012 16.059l30.681 30.693c13.39 13.392 13.477 35.125.268 48.636-13.51 13.2-35.227 13.112-48.623-.282l-30.692-30.689c-4.438-4.437-11.633-4.437-16.066 0-4.443 4.433-4.443 11.642 0 16.065l30.682 30.694c21.968 21.965 57.458 22.322 79.889 1.116.208-.184.404-.355.61-.549.094-.095.182-.192.273-.29.1-.095.197-.183.29-.289.197-.183.365-.384.54-.594 21.215-22.428 20.86-57.911-1.102-79.889l-30.692-30.682c-4.436-4.443-11.638-4.443-16.07.001z\" fill=\"#FFF\"/></svg>\n </a>\n Authy\n </span>\n \n <span>\n <a (click)=\"appTypeGoogle()\"> \n <svg width=\"50\" height=\"50\" viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m457.07 45.92c73.67-8.62 149.41.22 218.93 26.24 62.75 23.47 120.59 60.41 167.72 108.09-40.31 39.97-80.25 80.31-120.51 120.33-25.95-25.45-56.19-46.65-89.47-61.37-44.22-19.82-93.39-28.54-141.72-25.2-54.6 3.52-108.11 22.49-152.63 54.3-55.24 38.95-96.61 97.22-114.8 162.35-13.64 47.78-14.77 98.97-3.76 147.4 8.85 39.61 26.09 77.29 50.05 110.03 22.24 30.45 50.3 56.64 82.22 76.71 36.79 23.24 78.76 38.22 121.96 43.48 37.02 4.65 74.9 2.23 111.05-7 3.97-1.91 6.24 2.61 8.73 4.86 40.74 40.95 81.68 81.7 122.43 122.63-73.31 35.6-155.99 51.86-237.3 46.12-68.05-4.51-135.07-24.08-194.71-57.18-24.87-13.6-48.23-29.82-70.33-47.54-17.46-14.81-34.71-30.01-49.72-47.35-25.41-27.39-47.21-58.11-65.17-90.87-4-7.72-8.64-15.12-11.9-23.2-4.47-9.05-8.37-18.36-12.25-27.67-4.96-13.27-10.26-26.44-13.88-40.15-.43-1.81-1.53-3.33-2.52-4.85-8.3-28.66-12.95-58.33-15.44-88.04-2.62-37.36-1.33-75.05 4.78-112.03 12.18-75.48 43.41-147.74 89.86-208.44 30.12-39.5 66.53-74.21 107.46-102.35 62.44-43.11 135.53-70.69 210.92-79.3m49.18 50.48c-5.7.99-10.96 3.76-15.38 7.43-10.4 8.93-14.14 24.81-8.17 37.28 6.33 15.02 25.16 23.1 40.36 17 15.43-5.24 24.78-23.51 19.74-39.06-4.1-15.43-20.92-25.79-36.55-22.65m-267.96 111.99c-5.33.28-10.59 1.92-15.16 4.68-11.47 7.03-17.88 21.74-14.36 34.86 3.09 14.08 16.78 25.06 31.26 24.61 15.03.41 29.08-11.39 31.54-26.17 2.24-10.33-1.61-21.55-9.14-28.85-6.24-6.33-15.3-9.62-24.14-9.13m-115.96 272c-6.62 1.23-12.84 4.58-17.54 9.4-9.45 9.72-11.72 25.57-5.02 37.42 7.16 13.96 25.48 20.86 39.98 14.62 15.02-5.51 23.99-23.42 19.06-38.71-4.04-15.41-20.86-25.96-36.48-22.73m111.98 272.05c-11.49 1.95-21.48 10.72-24.84 21.88-3.87 11.63-.13 25.16 8.9 33.36 6.15 5.48 14.4 8.7 22.67 8.32 11.16-.25 21.98-6.87 27.12-16.8 4.93-8.83 5.15-20.02.71-29.1-5.82-12.78-20.81-20.33-34.56-17.66m272.06 112.03c-11.76 2.02-21.92 11.07-25.09 22.6-3.87 12.57 1.13 27.25 11.91 34.79 7.86 5.79 18.42 7.67 27.77 4.86 9.61-2.77 17.7-10.24 21.07-19.68 4.97-12.74.36-28.32-10.58-36.46-7.02-5.45-16.35-7.67-25.08-6.11z\" fill=\"#a0a0a0\"/>\n <g fill=\"#c1c1c1\">\n <path d=\"m506.25 96.4c15.63-3.14 32.45 7.22 36.55 22.65 5.04 15.55-4.31 33.82-19.74 39.06-15.2 6.1-34.03-1.98-40.36-17-5.97-12.47-2.23-28.35 8.17-37.28 4.42-3.67 9.68-6.44 15.38-7.43z\"/>\n <path d=\"m122.33 480.39c15.62-3.23 32.44 7.32 36.48 22.73 4.93 15.29-4.04 33.2-19.06 38.71-14.5 6.24-32.82-.66-39.98-14.62-6.7-11.85-4.43-27.7 5.02-37.42 4.7-4.82 10.92-8.17 17.54-9.4z\"/>\n </g>\n <path d=\"m843.72 180.25.11-.11c24.64 25.12 46.96 52.6 65.61 82.47 36.01 57.16 59.38 122.22 67.87 189.25 5.67 44.88 5.27 90.6-2.05 135.27-12.7 80.01-46.94 156.41-97.9 219.36-42.3 52.48-95.87 96.04-156.41 125.76l-.63-.26c-1.01-1.1-2.03-2.16-3.05-3.22-40.75-40.93-81.69-81.68-122.43-122.63-2.49-2.25-4.76-6.77-8.73-4.86-36.15 9.23-74.03 11.65-111.05 7-43.2-5.26-85.17-20.24-121.96-43.48-31.92-20.07-59.98-46.26-82.22-76.71-23.96-32.74-41.2-70.42-50.05-110.03-11.01-48.43-9.88-99.62 3.76-147.4 18.19-65.13 59.56-123.4 114.8-162.35 44.52-31.81 98.03-50.78 152.63-54.3 48.33-3.34 97.5 5.38 141.72 25.2 33.28 14.72 63.52 35.92 89.47 61.37 40.26-40.02 80.2-80.36 120.51-120.33m-351.75 183.97c-21.23 2.85-41.89 10.28-59.88 21.94-23.08 14.45-41.76 35.58-53.9 59.91-14.58 29.2-18.64 63.21-12.5 95.17 3.93 19.85 12.03 38.88 23.56 55.51 7.93 11.52 17.65 21.66 27.65 31.38 57.33 57.41 114.61 114.86 171.99 172.21 49.09-13.07 94.67-38.94 131.05-74.4 45.11-43.34 75.66-101.44 86.31-163.06.24-1.04.22-2.91 1.85-2.6 29.63.04 59.26-.01 88.9.05 19.04-.3 36.87-14.77 40.76-33.46.22-1.21 0-2.32-.67-3.35 1.22-5.71 2.08-11.58 1.38-17.43l-.24.4c-2.05-20.34-20.84-37.12-41.25-37.17-80.64-.07-161.28-.01-241.93-.07-6.44-22.08-18.5-42.33-34.03-59.23-25.8-27.5-62.26-45.01-100.02-46.82-9.68.02-19.44-.54-29.03 1.02m286.37 388.31c-12.64 2.06-23.37 12.59-25.7 25.18-1.48 8.14-.14 17.02 4.73 23.85 5.76 9.2 16.8 14.76 27.61 14.25 8.32.03 16.28-3.95 22.16-9.66 4.87-5.6 8.45-12.67 8.67-20.2.86-11.37-5.06-23.1-14.87-28.96-6.52-4.46-14.89-5.75-22.6-4.46z\" fill=\"#686868\"/>\n <path d=\"m238.29 208.39c8.84-.49 17.9 2.8 24.14 9.13 7.53 7.3 11.38 18.52 9.14 28.85-2.46 14.78-16.51 26.58-31.54 26.17-14.48.45-28.17-10.53-31.26-24.61-3.52-13.12 2.89-27.83 14.36-34.86 4.57-2.76 9.83-4.4 15.16-4.68z\" fill=\"#c3c3c3\"/>\n <path d=\"m491.97 364.22c9.59-1.56 19.35-1 29.03-1.02 37.76 1.81 74.22 19.32 100.02 46.82 15.53 16.9 27.59 37.15 34.03 59.23-47.67-.01-95.35-.01-143.03-.01-12.19-.11-24.23 5.42-32.21 14.61-6.01 6.85-9.74 15.65-10.44 24.74-1.19 14.17 5.36 28.7 16.69 37.28 7.62 5.91 17.28 9 26.92 8.8 126.69-.04 253.39-.06 380.08.03 4.76.04 9.59-.15 14.2-1.48 14.21-3.82 26.02-15.47 29.83-29.7.67 1.03.89 2.14.67 3.35-3.89 18.69-21.72 33.16-40.76 33.46-29.64-.06-59.27-.01-88.9-.05-1.63-.31-1.61 1.56-1.85 2.6-10.65 61.62-41.2 119.72-86.31 163.06-36.38 35.46-81.96 61.33-131.05 74.4-57.38-57.35-114.66-114.8-171.99-172.21-10-9.72-19.72-19.86-27.65-31.38-11.53-16.63-19.63-35.66-23.56-55.51-6.14-31.96-2.08-65.97 12.5-95.17 12.14-24.33 30.82-45.46 53.9-59.91 17.99-11.66 38.65-19.09 59.88-21.94z\" fill=\"#474747\"/>\n <g fill=\"#bfbfbf\">\n <path d=\"m479.81 483.85c7.98-9.19 20.02-14.72 32.21-14.61 47.68 0 95.36 0 143.03.01 80.65.06 161.29 0 241.93.07 20.41.05 39.2 16.83 41.25 37.17-.19.33-.58.97-.78 1.29-3.68-18.51-21.57-33.16-40.47-33.05-124.97.1-249.94.12-374.91.17-7.73.13-15.74-.8-23.15 1.96-9.06 2.84-16.73 9.1-22.27 16.7-3.34 4.55-4.39 10.24-7.28 15.03.7-9.09 4.43-17.89 10.44-24.74z\"/>\n <path d=\"m234.31 752.44c13.75-2.67 28.74 4.88 34.56 17.66 4.44 9.08 4.22 20.27-.71 29.1-5.14 9.93-15.96 16.55-27.12 16.8-8.27.38-16.52-2.84-22.67-8.32-9.03-8.2-12.77-21.73-8.9-33.36 3.36-11.16 13.35-19.93 24.84-21.88z\"/>\n </g>\n <path d=\"m498.92 476.86c7.41-2.76 15.42-1.83 23.15-1.96 124.97-.05 249.94-.07 374.91-.17 18.9-.11 36.79 14.54 40.47 33.05.2-.32.59-.96.78-1.29l.24-.4c.7 5.85-.16 11.72-1.38 17.43-3.81 14.23-15.62 25.88-29.83 29.7-4.61 1.33-9.44 1.52-14.2 1.48-126.69-.09-253.39-.07-380.08-.03-9.64.2-19.3-2.89-26.92-8.8-11.33-8.58-17.88-23.11-16.69-37.28 2.89-4.79 3.94-10.48 7.28-15.03 5.54-7.6 13.21-13.86 22.27-16.7z\" fill=\"#b0b0b0\"/>\n <path d=\"m59.49 636.08c.99 1.52 2.09 3.04 2.52 4.85 3.62 13.71 8.92 26.88 13.88 40.15 3.88 9.31 7.78 18.62 12.25 27.67 3.26 8.08 7.9 15.48 11.9 23.2 17.96 32.76 39.76 63.48 65.17 90.87 15.01 17.34 32.26 32.54 49.72 47.35 22.1 17.72 45.46 33.94 70.33 47.54 59.64 33.1 126.66 52.67 194.71 57.18 81.31 5.74 163.99-10.52 237.3-46.12 1.02 1.06 2.04 2.12 3.05 3.22l.03.61c-42.32 21.03-87.88 35.53-134.56 42.91-56.91 8.9-115.46 7.49-171.82-4.5-67.89-14.35-132.42-44.21-187.42-86.51-63.52-48.63-114.32-113.73-145.86-187.27-8.42-19.87-15.93-40.22-21.2-61.15z\" fill=\"#939393\"/>\n <path d=\"m778.34 752.53c7.71-1.29 16.08 0 22.6 4.46 9.81 5.86 15.73 17.59 14.87 28.96-.22 7.53-3.8 14.6-8.67 20.2-5.88 5.71-13.84 9.69-22.16 9.66-10.81.51-21.85-5.05-27.61-14.25-4.87-6.83-6.21-15.71-4.73-23.85 2.33-12.59 13.06-23.12 25.7-25.18z\" fill=\"#767676\"/>\n <path d=\"m506.37 864.47c8.73-1.56 18.06.66 25.08 6.11 10.94 8.14 15.55 23.72 10.58 36.46-3.37 9.44-11.46 16.91-21.07 19.68-9.35 2.81-19.91.93-27.77-4.86-10.78-7.54-15.78-22.22-11.91-34.79 3.17-11.53 13.33-20.58 25.09-22.6z\" fill=\"#bebebe\"/>\n </svg>\n </a>\n Google Authenticator\n </span>\n </div>\n </div>\n \n </div>\n\n <div *ngIf=\"mode === 'code-input'\" class=\"code-input\">\n <div>\n Enter the 6-digit code you see in the App.\n </div>\n\n <app-code-input\n (codeChanged)=\"codeChanged($event)\">\n </app-code-input>\n \n <div class=\"checkboxes\">\n <mat-checkbox name=\"default\" [(ngModel)]=\"default\" [disableRipple]=\"true\">\n Make this the default 2-step verification method\n </mat-checkbox>\n </div>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <ng-container *ngIf=\"appType\">\n <button\n *ngIf=\"mode === 'qr-code'\"\n type=\"button\"\n mat-button\n color=\"primary\"\n (click)=\"next()\">\n Next\n </button>\n <button\n *ngIf=\"mode === 'code-input'\"\n type=\"submit\"\n mat-button\n color=\"primary\"\n (click)=\"next()\">\n Verify\n </button> \n </ng-container>\n <button\n type=\"button\"\n mat-button\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: ["ul{margin:0;padding-left:24px}qr-code{display:flex;justify-content:center;margin:30px}app-code-input{margin-top:10px}.code-input{width:400px}.app-types{text-align:center;padding:0 40px}.app-types .row{display:flex;justify-content:center}.app-types .row span{display:flex;flex-direction:column;text-align:center;max-width:100px}.app-types .row span+span{margin-left:40px}.checkboxes{margin:8px 0}.checkboxes mat-checkbox{display:block}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: QrCodeComponent, selector: "app-qr-code", inputs: ["value"] }, { type: CodeInputComponent, selector: "app-code-input", inputs: ["codeLength", "code"], outputs: ["codeCompleted", "codeChanged"] }, { type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i8.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i9.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i9.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
606
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AppComponent, decorators: [{
607
- type: Component,
608
- args: [{
609
- templateUrl: './app.component.html',
610
- styleUrls: ['./app.component.scss'],
611
- changeDetection: ChangeDetectionStrategy.OnPush,
612
- }]
613
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
614
- type: Inject,
615
- args: [MAT_DIALOG_DATA]
616
- }] }, { type: i1.MatDialogRef }, { type: i0.ChangeDetectorRef }, { type: i2.FsMessage }]; }, propDecorators: { form: [{
617
- type: ViewChild,
618
- args: [FsFormDirective]
619
- }] } });
620
-
621
- class EmailComponent {
622
- constructor(_data, _dialogRef, _cdRef, _message) {
623
- this._data = _data;
624
- this._dialogRef = _dialogRef;
625
- this._cdRef = _cdRef;
626
- this._message = _message;
627
- this.verificationMethod = null;
628
- this.trustDevice = true;
629
- this.resend = () => {
630
- return this.twoFactorManageService.verificationMethodResend()
631
- .pipe(tap(() => {
632
- this._message.success('Resent verification code');
633
- }));
634
- };
635
- this.submit = () => {
636
- return of(true)
637
- .pipe(switchMap(() => {
638
- return this.verificationMethod ?
639
- this.twoFactorManageService.verificationMethodVerify$(this.code, this.trustDevice)
640
- .pipe(tap((verificationMethod) => {
641
- this._message.success('Created email verification method');
642
- this._dialogRef.close(verificationMethod);
643
- })) :
644
- this.twoFactorManageService.verificationMethodCreate$({
645
- type: VerificationMethodType.Email,
646
- email: this.email,
647
- default: this.default,
648
- })
649
- .pipe(tap((verificationMethod) => {
650
- this.verificationMethod = verificationMethod;
651
- this.form.clear();
652
- this._cdRef.markForCheck();
653
- }));
654
- }));
655
- };
656
- this.twoFactorManageService = _data.twoFactorManageService;
657
- this.default = !this.twoFactorManageService.hasVerificationMethods;
658
- }
659
- codeCompleted() {
660
- if (!this.form.submitting) {
661
- this.form.triggerSubmit();
662
- }
663
- }
664
- codeChanged(code) {
665
- this.code = code;
666
- }
667
- }
668
- EmailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: EmailComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.ChangeDetectorRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
669
- EmailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: EmailComponent, selector: "ng-component", viewQueries: [{ propertyName: "form", first: true, predicate: FsFormDirective, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"submit\">\n <fs-dialog>\n <h1 mat-dialog-title>\n Email Setup\n </h1>\n <mat-dialog-content>\n <ng-container *ngIf=\"verificationMethod; else notVerificationMethod\">\n <fs-2fa-verification\n [verificationMethod]=\"verificationMethod\"\n (codeChanged)=\"codeChanged($event)\"\n [resend]=\"resend\"\n [(trustDevice)]=\"trustDevice\">\n </fs-2fa-verification>\n </ng-container>\n\n <ng-template #notVerificationMethod>\n <p>The app will only use this email for verifying your account security. </p>\n <mat-form-field>\n <mat-label>Email</mat-label>\n <input\n matInput\n [required]=\"true\"\n [(ngModel)]=\"email\"\n [fsFormEmail]=\"true\"\n name=\"email\">\n </mat-form-field>\n <mat-checkbox \n name=\"default\"\n [(ngModel)]=\"default\"\n [disableRipple]=\"true\">\n Make this the default 2-step verification method\n </mat-checkbox>\n </ng-template>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n color=\"primary\"\n type=\"submit\">\n Next\n </button>\n <button\n mat-button\n type=\"button\"\n [mat-dialog-close]=\"undefined\">\n Cancel\n </button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: [":host ::ng-deep mat-checkbox .mat-ripple{display:none}mat-form-field{width:100%}mat-dialog-content{width:400px}p{margin-top:0}app-code-input{margin-bottom:5px;display:block}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: Fs2faVerificationComponent, selector: "fs-2fa-verification", inputs: ["verificationMethod", "resend", "showTrustedDevice", "trustDevice", "codeLength", "trustDays", "formatRecipient", "getVerificationMethods", "selectVerificationMethod"], outputs: ["verified", "codeChanged", "codeCompleted", "trustDeviceChange"] }, { type: i5$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i8.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i9.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.MatLabel, selector: "mat-label" }, { type: i11$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i8.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i9.FsFormEmailDirective, selector: "[fsFormEmail]", inputs: ["fsFormEmail", "fsFormEmailMessage"] }, { type: i9.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i9.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: EmailComponent, decorators: [{
671
- type: Component,
672
- args: [{
673
- templateUrl: './email.component.html',
674
- styleUrls: ['./email.component.scss'],
675
- changeDetection: ChangeDetectionStrategy.OnPush,
676
- }]
677
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
678
- type: Inject,
679
- args: [MAT_DIALOG_DATA]
680
- }] }, { type: i1.MatDialogRef }, { type: i0.ChangeDetectorRef }, { type: i2.FsMessage }]; }, propDecorators: { form: [{
681
- type: ViewChild,
682
- args: [FsFormDirective, { static: false }]
683
- }] } });
684
-
685
- class NumberComponent {
686
- constructor(_data, _dialogRef, _cdRef, _message) {
687
- this._data = _data;
688
- this._dialogRef = _dialogRef;
689
- this._cdRef = _cdRef;
690
- this._message = _message;
691
- this.trustDevice = true;
692
- this.verificationMethod = null;
693
- this.resend = () => {
694
- return this.twoFactorManageService.verificationMethodResend()
695
- .pipe(tap(() => {
696
- this._message.success('Resent verification code');
697
- }));
698
- };
699
- this.submit = () => {
700
- return of(true)
701
- .pipe(switchMap(() => {
702
- return this.verificationMethod ?
703
- this.twoFactorManageService.verificationMethodVerify$(this.code, this.trustDevice)
704
- .pipe(tap((verificationMethod) => {
705
- this._message.success('Created text message verification method');
706
- this._dialogRef.close(verificationMethod);
707
- })) :
708
- this.twoFactorManageService.verificationMethodCreate$({
709
- type: VerificationMethodType.Sms,
710
- phoneNumber: this.phone.number,
711
- phoneCode: this.phone.countryCode,
712
- phoneCountry: this.phone.isoCode,
713
- default: this.default,
714
- })
715
- .pipe(tap((verificationMethod) => {
716
- this.verificationMethod = verificationMethod;
717
- this.form.clear();
718
- this._cdRef.markForCheck();
719
- }));
720
- }));
721
- };
722
- this.twoFactorManageService = _data.twoFactorManageService;
723
- this.defaultCountry = _data.defaultCountry;
724
- this.default = !this.twoFactorManageService.hasVerificationMethods;
725
- }
726
- codeCompleted() {
727
- if (!this.form.submitting) {
728
- this.form.triggerSubmit();
729
- }
730
- }
731
- codeChanged(code) {
732
- this.code = code;
733
- }
734
- }
735
- NumberComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NumberComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i0.ChangeDetectorRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
736
- NumberComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NumberComponent, selector: "ng-component", viewQueries: [{ propertyName: "form", first: true, predicate: FsFormDirective, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"submit\" [autocomplete]=\"false\">\n <fs-dialog>\n <h1 mat-dialog-title>\n Text Message Setup\n </h1>\n <mat-dialog-content>\n <ng-container *ngIf=\"verificationMethod; else notVerificationMethod\">\n <fs-2fa-verification\n [verificationMethod]=\"verificationMethod\"\n (codeChanged)=\"codeChanged($event)\"\n [resend]=\"resend\"\n [formatRecipient]=\"true\"\n [(trustDevice)]=\"trustDevice\">\n </fs-2fa-verification>\n </ng-container>\n\n <ng-template #notVerificationMethod>\n <p>The app will only use this number for verifying your account security. Message and data rates may apply by your cell phone provider.</p>\n <mat-form-field>\n <mat-label>Phone number</mat-label>\n <input \n matInput\n fsPhoneField\n [(ngModel)]=\"phone\"\n [required]=\"true\"\n [country]=\"defaultCountry\"\n [mode]=\"'object'\"\n autocomplete=\"off\"\n name=\"phone\">\n </mat-form-field>\n <mat-checkbox \n name=\"default\"\n [(ngModel)]=\"default\"\n [disableRipple]=\"true\">\n Make this the default 2-step verification method\n </mat-checkbox>\n </ng-template>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n color=\"primary\"\n type=\"submit\">\n Next\n </button>\n <button\n mat-button\n type=\"button\"\n [mat-dialog-close]=\"undefined\">\n Cancel\n </button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: [":host ::ng-deep mat-checkbox .mat-ripple{display:none}app-code-input{margin-bottom:5px;display:block}mat-form-field{width:100%}mat-dialog-content{width:400px}p{margin-top:0}h1{display:flex;align-items:center}h1 mat-icon{margin-right:5px}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: Fs2faVerificationComponent, selector: "fs-2fa-verification", inputs: ["verificationMethod", "resend", "showTrustedDevice", "trustDevice", "codeLength", "trustDays", "formatRecipient", "getVerificationMethods", "selectVerificationMethod"], outputs: ["verified", "codeChanged", "codeCompleted", "trustDeviceChange"] }, { type: i5$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i8$1.FsPhoneFieldComponent, selector: "[fsPhoneField]", inputs: ["allowNumberExt", "placeholder", "required", "disabled", "mode", "country", "autocomplete"] }, { type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i8.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i9.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.MatLabel, selector: "mat-label" }, { type: i11$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i8.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i9.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NumberComponent, decorators: [{
738
- type: Component,
739
- args: [{
740
- templateUrl: './number.component.html',
741
- styleUrls: ['./number.component.scss'],
742
- changeDetection: ChangeDetectionStrategy.OnPush,
743
- }]
744
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
745
- type: Inject,
746
- args: [MAT_DIALOG_DATA]
747
- }] }, { type: i1.MatDialogRef }, { type: i0.ChangeDetectorRef }, { type: i2.FsMessage }]; }, propDecorators: { form: [{
748
- type: ViewChild,
749
- args: [FsFormDirective, { static: false }]
750
- }] } });
751
-
752
- class TwoFactorManageService {
753
- constructor(_dialog) {
754
- this._dialog = _dialog;
755
- this._destroy$ = new Subject();
756
- this._verificationMethods$ = new BehaviorSubject([]);
757
- }
758
- get verificationMethods$() {
759
- return this._verificationMethods$
760
- .pipe(takeUntil(this._destroy$));
761
- }
762
- get verificationMethods() {
763
- return this._verificationMethods$.getValue();
764
- }
765
- get hasVerificationMethods() {
766
- return !!this._verificationMethods$.getValue().length;
767
- }
768
- get emailVerificationMethods() {
769
- return this.getVerificationMethods(VerificationMethodType.Email);
770
- }
771
- get smsVerificationMethods() {
772
- return this.getVerificationMethods(VerificationMethodType.Sms);
773
- }
774
- get appVerificationMethods() {
775
- return this.getVerificationMethods(VerificationMethodType.App);
776
- }
777
- getVerificationMethods(type) {
778
- return this.verificationMethods
779
- .filter((verificationMethod) => {
780
- return verificationMethod.type === type;
781
- });
782
- }
783
- hasVerificationMethod(type) {
784
- return this.verificationMethods
785
- .some((verificationMethod) => {
786
- return verificationMethod.type === type;
787
- });
788
- }
789
- registerVerificationMethodDefault(value) {
790
- this._verificationMethodDefault = value;
791
- }
792
- registerVerificationMethodResend(value) {
793
- this._verificationMethodResend = value;
794
- }
795
- registerVerificationMethodsFetch(value) {
796
- this._verificationMethodsFetch = value;
797
- }
798
- registerVerificationMethodDelete(value) {
799
- this._verificationMethodDelete = value;
800
- }
801
- registerVerificationMethodCreate(value) {
802
- this._verificationMethodCreate = value;
803
- }
804
- registerVerificationMethodVerify(value) {
805
- this._verificationMethodVerify = value;
806
- }
807
- registerAccountVerify(value) {
808
- this._accountVerify = value;
809
- }
810
- get hasVerificationMethodResend() {
811
- return !!this._verificationMethodResend;
812
- }
813
- get hasVerificationMethodDefault() {
814
- return !!this._verificationMethodDefault;
815
- }
816
- get hasVerificationMethodsFetch() {
817
- return !!this._verificationMethodsFetch;
818
- }
819
- get hasVerificationMethodDelete() {
820
- return !!this._verificationMethodDelete;
821
- }
822
- get hasVerificationMethodCreate() {
823
- return !!this._verificationMethodCreate;
824
- }
825
- get hasVerificationMethodVerify() {
826
- return !!this._verificationMethodVerify;
827
- }
828
- verificationMethodDelete$(verificationMethod) {
829
- return this._verificationMethodDelete(verificationMethod)
830
- .pipe(tap(() => {
831
- this.verificationMethodsFetch();
832
- }));
833
- }
834
- verificationMethodVerify$(code, trustDevice) {
835
- return this._verificationMethodVerify(code, trustDevice)
836
- .pipe(tap(() => {
837
- this.verificationMethodsFetch();
838
- }));
839
- }
840
- verificationMethodCreate$(verificationMethod) {
841
- return this._verificationMethodCreate(verificationMethod);
842
- }
843
- verificationMethodDefault$(verificationMethod) {
844
- return this._verificationMethodDefault(verificationMethod);
845
- }
846
- verificationMethodResend() {
847
- return this._verificationMethodResend();
848
- }
849
- verificationMethodsFetch(query) {
850
- this.verificationMethodsFetch$(query)
851
- .subscribe();
852
- }
853
- verificationMethodsFetch$(query) {
854
- return this._verificationMethodsFetch(query)
855
- .pipe(tap((verificationMethods) => {
856
- this._verificationMethods$.next(verificationMethods);
857
- }));
858
- }
859
- accountVerify$() {
860
- return this._accountVerify ? this._accountVerify() : of(true);
861
- }
862
- ngOnDestroy() {
863
- this._destroy$.next();
864
- this._destroy$.complete();
865
- }
866
- addSms$(defaultCountry) {
867
- return this.accountVerify$()
868
- .pipe(switchMap(() => this._dialog.open(NumberComponent, {
869
- data: {
870
- defaultCountry,
871
- twoFactorManageService: this,
872
- },
873
- })
874
- .afterClosed()), tap(() => {
875
- this.verificationMethodsFetch();
876
- }), takeUntil(this._destroy$));
877
- }
878
- addEmail$() {
879
- return this.accountVerify$()
880
- .pipe(switchMap(() => this._dialog.open(EmailComponent, {
881
- data: { twoFactorManageService: this },
882
- })
883
- .afterClosed()), tap(() => {
884
- this.verificationMethodsFetch();
885
- }), takeUntil(this._destroy$));
886
- }
887
- addApp$() {
888
- return this.accountVerify$()
889
- .pipe(switchMap(() => this._dialog.open(AppComponent, {
890
- data: { twoFactorManageService: this },
891
- })
892
- .afterClosed()), tap(() => {
893
- this.verificationMethodsFetch();
894
- }), takeUntil(this._destroy$));
895
- }
896
- }
897
- TwoFactorManageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TwoFactorManageService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
898
- TwoFactorManageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TwoFactorManageService });
899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TwoFactorManageService, decorators: [{
900
- type: Injectable
901
- }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
902
-
903
- class VerificationMethodsComponent {
904
- constructor(_prompt) {
905
- this._prompt = _prompt;
906
- this.deleted = new EventEmitter();
907
- this.VerificationMethodType = VerificationMethodType;
908
- }
909
- ngOnInit() {
910
- var _a, _b, _c, _d;
911
- if (!this.verificationMethodDefault && ((_a = this.twoFactorManageService) === null || _a === void 0 ? void 0 : _a.hasVerificationMethodDefault)) {
912
- this.verificationMethodDefault = (verificationMethod) => {
913
- return this.twoFactorManageService.verificationMethodDefault$(verificationMethod);
914
- };
915
- }
916
- if (!this.verificationMethodDelete && ((_b = this.twoFactorManageService) === null || _b === void 0 ? void 0 : _b.hasVerificationMethodDelete)) {
917
- this.verificationMethodDelete = (verificationMethod) => {
918
- return this.twoFactorManageService.verificationMethodDelete$(verificationMethod);
919
- };
920
- }
921
- if (!this.verificationMethodsFetch && ((_c = this.twoFactorManageService) === null || _c === void 0 ? void 0 : _c.hasVerificationMethodsFetch)) {
922
- this.verificationMethodsFetch = (query) => {
923
- return this.twoFactorManageService.verificationMethodsFetch$(query);
924
- };
925
- }
926
- if (!this.accountVerify && ((_d = this.twoFactorManageService) === null || _d === void 0 ? void 0 : _d.hasVerificationMethodVerify)) {
927
- this.accountVerify = () => {
928
- var _a;
929
- return (_a = this.twoFactorManageService) === null || _a === void 0 ? void 0 : _a.accountVerify$();
930
- };
931
- }
932
- this.listConfig = {
933
- paging: false,
934
- rowActions: [
935
- {
936
- click: (verificationMethod) => {
937
- this.accountVerify()
938
- .pipe(switchMap(() => this.verificationMethodDefault(verificationMethod)))
939
- .subscribe(() => {
940
- this.list.reload();
941
- });
942
- },
943
- show: (data) => {
944
- return !!this.verificationMethodDefault && !data.default;
945
- },
946
- label: 'Set as Default',
947
- },
948
- {
949
- click: (verificationMethod) => {
950
- this._prompt.confirm({
951
- title: 'Confirm',
952
- template: 'Would you like to delete this verification method?',
953
- })
954
- .pipe(switchMap(() => this.accountVerify()), switchMap(() => this.verificationMethodDelete(verificationMethod)))
955
- .subscribe(() => {
956
- this.deleted.emit();
957
- this.list.reload();
958
- });
959
- },
960
- show: () => {
961
- return !!this.verificationMethodDelete;
962
- },
963
- label: 'Delete',
964
- },
965
- ],
966
- fetch: (query) => {
967
- query = Object.assign(Object.assign({}, query), { type: this.type });
968
- return this.verificationMethodsFetch(query)
969
- .pipe(map((verificationMethods) => ({
970
- data: verificationMethods.filter((verificationMethod) => {
971
- return !this.type || verificationMethod.type === this.type;
972
- }),
973
- })));
974
- },
975
- };
976
- }
977
- reload() {
978
- this.list.reload();
979
- }
980
- }
981
- VerificationMethodsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: VerificationMethodsComponent, deps: [{ token: i1$3.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
982
- VerificationMethodsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: VerificationMethodsComponent, selector: "fs-2fa-verification-methods", inputs: { type: "type", accountVerify: "accountVerify", verificationMethodsFetch: "verificationMethodsFetch", verificationMethodDelete: "verificationMethodDelete", verificationMethodDefault: "verificationMethodDefault", twoFactorManageService: "twoFactorManageService" }, outputs: { deleted: "deleted" }, viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\">\n <fs-list-column class=\"col-icon\" width=\"1%\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.type === VerificationMethodType.Sms\">\n <mat-icon>textsms</mat-icon>\n </ng-container>\n\n <ng-container *ngIf=\"row.type === VerificationMethodType.Email\">\n <mat-icon>email</mat-icon>\n </ng-container>\n\n <ng-container *ngIf=\"row.type === VerificationMethodType.App\">\n <mat-icon>phone_iphone</mat-icon>\n </ng-container>\n </ng-template>\n </fs-list-column>\n <fs-list-column class=\"col-name\">\n <ng-template fs-list-cell let-row=\"row\">\n <div class=\"row\">\n <ng-container *ngIf=\"row.type === VerificationMethodType.Sms\">\n <div class=\"row\">\n <fs-country [code]=\"row.phoneCountry\" [showName]=\"false\"></fs-country> \n <span>{{row.phoneNumber | fsPhone}}</span>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"row.type === VerificationMethodType.Email\">\n {{row.email}}\n </ng-container>\n\n <ng-container *ngIf=\"row.type === VerificationMethodType.App\">\n App\n </ng-container>\n\n <app-defaulted *ngIf=\"row.default\"></app-defaulted>\n </div>\n </ng-template>\n </fs-list-column>\n</fs-list>", styles: [":host ::ng-deep .col-name .row{display:flex;align-items:center}:host ::ng-deep .col-name fs-country img{display:flex}fs-country{margin-right:5px}app-defaulted{margin-left:5px}\n"], components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4$1.FsCountryComponent, selector: "fs-country", inputs: ["code", "showIcon", "showName", "region", "width"] }, { type: DefaultedComponent, selector: "app-defaulted" }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fsPhone": i8$1.FsPhonePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
983
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: VerificationMethodsComponent, decorators: [{
984
- type: Component,
985
- args: [{
986
- selector: 'fs-2fa-verification-methods',
987
- templateUrl: './verification-methods.component.html',
988
- styleUrls: ['./verification-methods.component.scss'],
989
- changeDetection: ChangeDetectionStrategy.OnPush,
990
- }]
991
- }], ctorParameters: function () { return [{ type: i1$3.FsPrompt }]; }, propDecorators: { list: [{
992
- type: ViewChild,
993
- args: [FsListComponent]
994
- }], type: [{
995
- type: Input
996
- }], accountVerify: [{
997
- type: Input
998
- }], verificationMethodsFetch: [{
999
- type: Input
1000
- }], verificationMethodDelete: [{
1001
- type: Input
1002
- }], verificationMethodDefault: [{
1003
- type: Input
1004
- }], twoFactorManageService: [{
1005
- type: Input
1006
- }], deleted: [{
1007
- type: Output
1008
- }] } });
1009
-
1010
- class Fs2faVerificationMethodsModule {
1011
- }
1012
- Fs2faVerificationMethodsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1013
- Fs2faVerificationMethodsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsModule, declarations: [VerificationMethodsComponent], imports: [CommonModule,
1014
- FormsModule,
1015
- MatIconModule,
1016
- FsListModule,
1017
- FsPhoneModule,
1018
- FsCountryModule,
1019
- DefautledModule], exports: [VerificationMethodsComponent] });
1020
- Fs2faVerificationMethodsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsModule, imports: [[
1021
- CommonModule,
1022
- FormsModule,
1023
- MatIconModule,
1024
- FsListModule,
1025
- FsPhoneModule,
1026
- FsCountryModule,
1027
- DefautledModule,
1028
- ]] });
1029
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faVerificationMethodsModule, decorators: [{
1030
- type: NgModule,
1031
- args: [{
1032
- imports: [
1033
- CommonModule,
1034
- FormsModule,
1035
- MatIconModule,
1036
- FsListModule,
1037
- FsPhoneModule,
1038
- FsCountryModule,
1039
- DefautledModule,
1040
- ],
1041
- declarations: [
1042
- VerificationMethodsComponent,
1043
- ],
1044
- exports: [VerificationMethodsComponent],
1045
- }]
1046
- }] });
1047
-
1048
- class NumbersComponent {
1049
- constructor(_data, _dialogRef, _message) {
1050
- this._data = _data;
1051
- this._dialogRef = _dialogRef;
1052
- this._message = _message;
1053
- this.VerificationMethodType = VerificationMethodType;
1054
- this.twoFactorManageService = _data.twoFactorManageService;
1055
- this.defaultCountry = _data.defaultCountry;
1056
- }
1057
- add() {
1058
- this.twoFactorManageService.addSms$(this.defaultCountry)
1059
- .subscribe(() => {
1060
- this.verificationMethods.reload();
1061
- });
1062
- }
1063
- deleted() {
1064
- this._message.success('Deleted text message verification method');
1065
- if (!this.twoFactorManageService.hasVerificationMethod(VerificationMethodType.Sms)) {
1066
- this._dialogRef.close();
1067
- }
1068
- }
1069
- }
1070
- NumbersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NumbersComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
1071
- NumbersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NumbersComponent, selector: "ng-component", viewQueries: [{ propertyName: "verificationMethods", first: true, predicate: VerificationMethodsComponent, descendants: true }], ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>\n <mat-icon>textsms</mat-icon> Text Message Numbers\n </h1>\n <mat-dialog-content>\n <fs-2fa-verification-methods\n [type]=\"VerificationMethodType.Sms\"\n [twoFactorManageService]=\"twoFactorManageService\"\n (deleted)=\"deleted()\">\n </fs-2fa-verification-methods> \n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"undefined\">\n Close\n </button>\n <button\n mat-button\n (click)=\"add()\"\n type=\"button\">\n Add Number\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: [""], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: VerificationMethodsComponent, selector: "fs-2fa-verification-methods", inputs: ["type", "accountVerify", "verificationMethodsFetch", "verificationMethodDelete", "verificationMethodDefault", "twoFactorManageService"], outputs: ["deleted"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1072
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NumbersComponent, decorators: [{
1073
- type: Component,
1074
- args: [{
1075
- templateUrl: './numbers.component.html',
1076
- styleUrls: ['./numbers.component.scss'],
1077
- changeDetection: ChangeDetectionStrategy.OnPush,
1078
- }]
1079
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1080
- type: Inject,
1081
- args: [MAT_DIALOG_DATA]
1082
- }] }, { type: i1.MatDialogRef }, { type: i2.FsMessage }]; }, propDecorators: { verificationMethods: [{
1083
- type: ViewChild,
1084
- args: [VerificationMethodsComponent]
1085
- }] } });
1086
-
1087
- class EmailsComponent {
1088
- constructor(_data, _dialogRef, _message) {
1089
- this._data = _data;
1090
- this._dialogRef = _dialogRef;
1091
- this._message = _message;
1092
- this.VerificationMethodType = VerificationMethodType;
1093
- this.twoFactorManageService = _data.twoFactorManageService;
1094
- }
1095
- add() {
1096
- this.twoFactorManageService.addEmail$()
1097
- .subscribe(() => {
1098
- this.verificationMethods.reload();
1099
- });
1100
- }
1101
- deleted() {
1102
- this._message.success('Deleted email verification method');
1103
- if (!this.twoFactorManageService.hasVerificationMethod(VerificationMethodType.Email)) {
1104
- this._dialogRef.close();
1105
- }
1106
- }
1107
- }
1108
- EmailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: EmailsComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
1109
- EmailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: EmailsComponent, selector: "ng-component", viewQueries: [{ propertyName: "verificationMethods", first: true, predicate: VerificationMethodsComponent, descendants: true }], ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>\n <mat-icon>email</mat-icon> Emails\n </h1>\n <mat-dialog-content>\n <fs-2fa-verification-methods\n [type]=\"VerificationMethodType.Email\"\n [twoFactorManageService]=\"twoFactorManageService\"\n (deleted)=\"deleted()\">\n </fs-2fa-verification-methods>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"undefined\">\n Close\n </button>\n <button\n mat-button\n (click)=\"add()\"\n type=\"button\">\n Add Email\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex;align-items:center}h1 mat-icon{margin-right:5px}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: VerificationMethodsComponent, selector: "fs-2fa-verification-methods", inputs: ["type", "accountVerify", "verificationMethodsFetch", "verificationMethodDelete", "verificationMethodDefault", "twoFactorManageService"], outputs: ["deleted"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: EmailsComponent, decorators: [{
1111
- type: Component,
1112
- args: [{
1113
- templateUrl: './emails.component.html',
1114
- styleUrls: ['./emails.component.scss'],
1115
- changeDetection: ChangeDetectionStrategy.OnPush,
1116
- }]
1117
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1118
- type: Inject,
1119
- args: [MAT_DIALOG_DATA]
1120
- }] }, { type: i1.MatDialogRef }, { type: i2.FsMessage }]; }, propDecorators: { verificationMethods: [{
1121
- type: ViewChild,
1122
- args: [VerificationMethodsComponent]
1123
- }] } });
1124
-
1125
- class ManageMethodsComponent {
1126
- constructor(_data, _cdRef, _dialog, _message) {
1127
- this._data = _data;
1128
- this._cdRef = _cdRef;
1129
- this._dialog = _dialog;
1130
- this._message = _message;
1131
- this.verificationMethodTypes = {};
1132
- this.VerificationMethodType = VerificationMethodType;
1133
- this._destroy$ = new Subject();
1134
- }
1135
- ngOnInit() {
1136
- this._defaultCountry = this._data.defaultCountry;
1137
- this.twoFactorManageService = this._data.twoFactorManageService;
1138
- this.verificationMethodTypes = this._data.verificationMethodTypes
1139
- .reduce((verificationMethodTypes, verificationMethodType) => {
1140
- verificationMethodTypes[verificationMethodType] = true;
1141
- return verificationMethodTypes;
1142
- }, {});
1143
- this.twoFactorManageService.verificationMethods$
1144
- .subscribe((verificationMethods) => {
1145
- this.verificationMethods = verificationMethods;
1146
- this._cdRef.markForCheck();
1147
- });
1148
- }
1149
- get defaultSms() {
1150
- return this.twoFactorManageService.smsVerificationMethods
1151
- .some((verificationMethod) => {
1152
- return verificationMethod.default;
1153
- });
1154
- }
1155
- get defaultApp() {
1156
- return this.twoFactorManageService.appVerificationMethods
1157
- .some((verificationMethod) => {
1158
- return verificationMethod.default;
1159
- });
1160
- }
1161
- get defaultEmail() {
1162
- return this.twoFactorManageService.emailVerificationMethods
1163
- .some((verificationMethod) => {
1164
- return verificationMethod.default;
1165
- });
1166
- }
1167
- get textHasVerificationMethod() {
1168
- return this.twoFactorManageService.hasVerificationMethod(VerificationMethodType.Sms);
1169
- }
1170
- get appHasVerificationMethod() {
1171
- return this.twoFactorManageService.hasVerificationMethod(VerificationMethodType.App);
1172
- }
1173
- get emailHasVerificationMethod() {
1174
- return this.twoFactorManageService.hasVerificationMethod(VerificationMethodType.Email);
1175
- }
1176
- textMessageManage() {
1177
- this._dialog.open(NumbersComponent, {
1178
- data: {
1179
- twoFactorManageService: this.twoFactorManageService,
1180
- defaultCountry: this._defaultCountry,
1181
- },
1182
- });
1183
- }
1184
- textMessageAdd() {
1185
- this.twoFactorManageService.addSms$(this._defaultCountry)
1186
- .subscribe();
1187
- }
1188
- emailMessageManage() {
1189
- this._dialog.open(EmailsComponent, {
1190
- data: {
1191
- twoFactorManageService: this.twoFactorManageService,
1192
- },
1193
- });
1194
- }
1195
- emailMessageAdd() {
1196
- this.twoFactorManageService.addEmail$()
1197
- .subscribe();
1198
- }
1199
- appRemove() {
1200
- const verificationMethod = this.verificationMethods
1201
- .find((_verificationMethod) => {
1202
- return _verificationMethod.type === VerificationMethodType.App;
1203
- });
1204
- if (verificationMethod) {
1205
- this.twoFactorManageService.accountVerify$()
1206
- .pipe(switchMap(() => this.twoFactorManageService.verificationMethodDelete$(verificationMethod)))
1207
- .subscribe(() => {
1208
- this._message.success('Removed App Authenticator verification method');
1209
- this._cdRef.markForCheck();
1210
- });
1211
- }
1212
- }
1213
- appAdd() {
1214
- this.twoFactorManageService.addApp$()
1215
- .subscribe();
1216
- }
1217
- ngOnDestroy() {
1218
- this._destroy$.next();
1219
- this._destroy$.complete();
1220
- }
1221
- }
1222
- ManageMethodsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ManageMethodsComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }, { token: i1.MatDialog }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
1223
- ManageMethodsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ManageMethodsComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>2-Step Verification</h1>\n <mat-dialog-content>\n <table>\n <tr *ngIf=\"verificationMethodTypes[VerificationMethodType.Sms]\">\n <td>\n <mat-icon>textsms</mat-icon>\n </td>\n <td>\n <div class=\"type\">\n <span>Text Message</span>\n <span *ngIf=\"textHasVerificationMethod\" class=\"enabled\"></span>\n <app-defaulted *ngIf=\"defaultSms\"></app-defaulted>\n </div>\n <div class=\"small\">\n Verification codes are sent by text message\n <ng-container *ngIf=\"textHasVerificationMethod\">\n to <span class=\"items\">\n <span *ngFor=\"let item of twoFactorManageService.smsVerificationMethods\">{{item.phoneNumber | fsPhone}}</span>\n </span>\n </ng-container>\n </div>\n </td>\n <td>\n <button \n *ngIf=\"textHasVerificationMethod; else textMessageManageButton\"\n mat-raised-button \n type=\"button\"\n (click)=\"textMessageManage()\">\n Manage\n </button>\n <ng-template #textMessageManageButton>\n <button \n mat-raised-button \n color=\"primary\"\n type=\"button\"\n (click)=\"textMessageAdd()\">\n Turn On\n </button>\n </ng-template>\n </td>\n </tr>\n <tr *ngIf=\"verificationMethodTypes[VerificationMethodType.Email]\">\n <td>\n <mat-icon>email</mat-icon>\n </td>\n <td>\n <div class=\"type\">\n <span>Email</span> \n <span *ngIf=\"emailHasVerificationMethod\" class=\"enabled\"></span>\n <app-defaulted *ngIf=\"defaultEmail\"></app-defaulted>\n </div>\n <div class=\"small\">\n Verification codes are sent by email\n <ng-container *ngIf=\"emailHasVerificationMethod\">\n to <span class=\"items\">\n <span *ngFor=\"let item of twoFactorManageService.emailVerificationMethods\">{{item.email}}</span>\n </span>\n </ng-container>\n </div>\n </td>\n <td>\n <button \n *ngIf=\"emailHasVerificationMethod; else emailMessageManageButton\"\n mat-raised-button \n type=\"button\"\n (click)=\"emailMessageManage()\">\n Manage\n </button>\n <ng-template #emailMessageManageButton>\n <button \n mat-raised-button \n color=\"primary\"\n type=\"button\"\n (click)=\"emailMessageAdd()\">\n Turn On\n </button>\n </ng-template>\n </td>\n </tr>\n <tr *ngIf=\"verificationMethodTypes[VerificationMethodType.App]\">\n <td>\n <mat-icon>phone_iphone</mat-icon>\n </td>\n <td>\n <div class=\"type\">\n <span>Authenticator App</span>\n <span *ngIf=\"appHasVerificationMethod\" class=\"enabled\"></span>\n <app-defaulted *ngIf=\"defaultApp\"></app-defaulted>\n </div>\n <div class=\"small\">Verification code is generated by an authenticator app such as Authy or Google Authenticator</div>\n </td>\n <td>\n <button \n *ngIf=\"appHasVerificationMethod; else appMessageManageButton\"\n mat-raised-button \n type=\"button\"\n (click)=\"appRemove()\">\n Remove\n </button>\n <ng-template #appMessageManageButton>\n <button \n mat-raised-button \n color=\"primary\"\n type=\"button\"\n (click)=\"appAdd()\">\n Turn On\n </button>\n </ng-template>\n </td>\n </tr> \n </table> \n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n color=\"primary\"\n type=\"button\"\n [mat-dialog-close]=\"undefined\">\n Close\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["mat-dialog-content{max-width:500px}.enabled{font-size:75%;background-color:#70b601;padding:2px 4px;border-radius:4px;color:#fff;margin-left:4px}.enabled:after{content:\"Enabled\"}table tr td:first-child,table tr td:last-child{width:1%}table tr td:first-child mat-icon,table tr td:last-child mat-icon{display:flex}table tr td{padding:6px;vertical-align:middle}table tr .type{display:flex;align-items:center}table tr .type app-defaulted{margin-left:4px}.items span+span:not(:last-child):before{content:\", \"}.items span+span:last-child:before{content:\" and \"}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: DefaultedComponent, selector: "app-defaulted" }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], pipes: { "fsPhone": i8$1.FsPhonePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ManageMethodsComponent, decorators: [{
1225
- type: Component,
1226
- args: [{
1227
- templateUrl: './manage-methods.component.html',
1228
- styleUrls: ['./manage-methods.component.scss'],
1229
- changeDetection: ChangeDetectionStrategy.OnPush,
1230
- }]
1231
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1232
- type: Inject,
1233
- args: [MAT_DIALOG_DATA]
1234
- }] }, { type: i0.ChangeDetectorRef }, { type: i1.MatDialog }, { type: i2.FsMessage }]; } });
1235
-
1236
- class Fs2faManageComponent {
1237
- constructor(_cdRef, _dialog, _twoFactorManageService) {
1238
- this._cdRef = _cdRef;
1239
- this._dialog = _dialog;
1240
- this._twoFactorManageService = _twoFactorManageService;
1241
- this._destroy$ = new Subject();
1242
- }
1243
- ngOnInit() {
1244
- this.verificationMethodTypes = this.verificationMethodTypes || [
1245
- VerificationMethodType.Sms,
1246
- VerificationMethodType.Email,
1247
- VerificationMethodType.App
1248
- ];
1249
- this._twoFactorManageService.registerVerificationMethodsFetch(this.verificationMethodsFetch);
1250
- this._twoFactorManageService.registerVerificationMethodDelete(this.verificationMethodDelete);
1251
- this._twoFactorManageService.registerVerificationMethodCreate(this.verificationMethodCreate);
1252
- this._twoFactorManageService.registerVerificationMethodVerify(this.verificationMethodVerify);
1253
- this._twoFactorManageService.registerVerificationMethodResend(this.verificationMethodResend);
1254
- this._twoFactorManageService.registerVerificationMethodDefault(this.verificationMethodDefault);
1255
- this._twoFactorManageService.registerAccountVerify(this.accountVerify);
1256
- this._twoFactorManageService.verificationMethods$
1257
- .subscribe((verificationMethods) => {
1258
- const types = {
1259
- sms: 'Text Message',
1260
- email: 'Email',
1261
- app: 'Authenticator App',
1262
- };
1263
- this.statuses = Object.keys(verificationMethods.reduce((accum, verificationMethod) => {
1264
- accum[verificationMethod.type] = true;
1265
- return accum;
1266
- }, {}))
1267
- .map((type) => {
1268
- return types[type];
1269
- });
1270
- this._cdRef.markForCheck();
1271
- });
1272
- this._twoFactorManageService.verificationMethodsFetch();
1273
- }
1274
- manage() {
1275
- const dialogRef = this._dialog.open(ManageMethodsComponent, {
1276
- autoFocus: false,
1277
- data: {
1278
- defaultCountry: this.defaultCountry,
1279
- twoFactorManageService: this._twoFactorManageService,
1280
- verificationMethodTypes: this.verificationMethodTypes,
1281
- },
1282
- });
1283
- dialogRef.afterClosed()
1284
- .pipe(takeUntil(this._destroy$))
1285
- .subscribe(() => {
1286
- this._cdRef.markForCheck();
1287
- });
1288
- }
1289
- reload() {
1290
- this._twoFactorManageService.verificationMethodsFetch();
1291
- }
1292
- ngOnDestroy() {
1293
- this._destroy$.next();
1294
- this._destroy$.complete();
1295
- }
1296
- }
1297
- Fs2faManageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.MatDialog }, { token: TwoFactorManageService }], target: i0.ɵɵFactoryTarget.Component });
1298
- Fs2faManageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: Fs2faManageComponent, selector: "fs-2fa-manage", inputs: { accountVerify: "accountVerify", defaultCountry: "defaultCountry", verificationMethodTypes: "verificationMethodTypes", verificationMethodsFetch: "verificationMethodsFetch", verificationMethodDelete: "verificationMethodDelete", verificationMethodCreate: "verificationMethodCreate", verificationMethodDefault: "verificationMethodDefault", verificationMethodVerify: "verificationMethodVerify", verificationMethodResend: "verificationMethodResend" }, providers: [TwoFactorManageService], ngImport: i0, template: "<fs-label-field>\n <fs-label>Status</fs-label>\n <ng-container *ngIf=\"statuses\">\n <ng-container *ngIf=\"statuses.length === 1\">\n {{statuses[0]}} verification is enabled\n </ng-container>\n\n <ng-container *ngIf=\"statuses.length > 1\">\n {{statuses.join(', ')}} verifications are enabled\n </ng-container>\n\n <ng-container *ngIf=\"statuses.length === 0\">\n No verification methods are enabled\n </ng-container>\n </ng-container>\n</fs-label-field>", styles: [""], components: [{ type: i3$2.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i3$2.FsLabelComponent, selector: "fs-label" }], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1299
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageComponent, decorators: [{
1300
- type: Component,
1301
- args: [{
1302
- selector: 'fs-2fa-manage',
1303
- templateUrl: './2fa-manage.component.html',
1304
- styleUrls: ['./2fa-manage.component.scss'],
1305
- changeDetection: ChangeDetectionStrategy.OnPush,
1306
- providers: [TwoFactorManageService],
1307
- }]
1308
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.MatDialog }, { type: TwoFactorManageService }]; }, propDecorators: { accountVerify: [{
1309
- type: Input
1310
- }], defaultCountry: [{
1311
- type: Input
1312
- }], verificationMethodTypes: [{
1313
- type: Input
1314
- }], verificationMethodsFetch: [{
1315
- type: Input
1316
- }], verificationMethodDelete: [{
1317
- type: Input
1318
- }], verificationMethodCreate: [{
1319
- type: Input
1320
- }], verificationMethodDefault: [{
1321
- type: Input
1322
- }], verificationMethodVerify: [{
1323
- type: Input
1324
- }], verificationMethodResend: [{
1325
- type: Input
1326
- }] } });
1327
-
1328
- class Fs2faManageModule {
1329
- }
1330
- Fs2faManageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1331
- Fs2faManageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageModule, declarations: [Fs2faManageComponent,
1332
- ManageMethodsComponent,
1333
- NumbersComponent,
1334
- AppComponent,
1335
- EmailComponent,
1336
- NumberComponent,
1337
- EmailsComponent,
1338
- QrCodeComponent], imports: [CommonModule,
1339
- FormsModule,
1340
- MatButtonModule,
1341
- MatDialogModule,
1342
- MatInputModule,
1343
- MatIconModule,
1344
- MatCheckboxModule,
1345
- FsDialogModule,
1346
- FsListModule,
1347
- FsFormModule,
1348
- FsLabelModule,
1349
- FsPhoneModule,
1350
- FsSkeletonModule,
1351
- FsCountryModule,
1352
- CodeInputModule,
1353
- ResendModule,
1354
- DefautledModule,
1355
- Fs2faVerificationModule,
1356
- Fs2faVerificationMethodsModule], exports: [Fs2faManageComponent] });
1357
- Fs2faManageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageModule, imports: [[
1358
- CommonModule,
1359
- FormsModule,
1360
- MatButtonModule,
1361
- MatDialogModule,
1362
- MatInputModule,
1363
- MatIconModule,
1364
- MatCheckboxModule,
1365
- FsDialogModule,
1366
- FsListModule,
1367
- FsFormModule,
1368
- FsLabelModule,
1369
- FsPhoneModule,
1370
- FsSkeletonModule,
1371
- FsCountryModule,
1372
- CodeInputModule,
1373
- ResendModule,
1374
- DefautledModule,
1375
- Fs2faVerificationModule,
1376
- Fs2faVerificationMethodsModule,
1377
- ]] });
1378
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2faManageModule, decorators: [{
1379
- type: NgModule,
1380
- args: [{
1381
- imports: [
1382
- CommonModule,
1383
- FormsModule,
1384
- MatButtonModule,
1385
- MatDialogModule,
1386
- MatInputModule,
1387
- MatIconModule,
1388
- MatCheckboxModule,
1389
- FsDialogModule,
1390
- FsListModule,
1391
- FsFormModule,
1392
- FsLabelModule,
1393
- FsPhoneModule,
1394
- FsSkeletonModule,
1395
- FsCountryModule,
1396
- CodeInputModule,
1397
- ResendModule,
1398
- DefautledModule,
1399
- Fs2faVerificationModule,
1400
- Fs2faVerificationMethodsModule,
1401
- ],
1402
- declarations: [
1403
- Fs2faManageComponent,
1404
- ManageMethodsComponent,
1405
- NumbersComponent,
1406
- AppComponent,
1407
- EmailComponent,
1408
- NumberComponent,
1409
- EmailsComponent,
1410
- QrCodeComponent,
1411
- ],
1412
- exports: [Fs2faManageComponent],
1413
- }]
1414
- }] });
1415
-
1416
- /**
1417
- * Generated bundle index. Do not edit.
1418
- */
1419
-
1420
- export { Fs2faManageComponent, Fs2faManageModule, Fs2faVerificationComponent, Fs2faVerificationMethodsModule, Fs2faVerificationModule, Fs2faVerificationResendDirective, VerificationMethodType, VerificationMethodsComponent };
1421
- //# sourceMappingURL=firestitch-2fa.js.map