@molecule/app-settings-panel-angular 2.0.1 → 3.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.
- package/README.md +171 -127
- package/dist/account-section.component.js +1 -2
- package/dist/account-section.component.js.map +1 -1
- package/dist/auth-section.component.d.ts +30 -10
- package/dist/auth-section.component.d.ts.map +1 -1
- package/dist/auth-section.component.js +159 -116
- package/dist/auth-section.component.js.map +1 -1
- package/dist/billing-section.component.d.ts +10 -7
- package/dist/billing-section.component.d.ts.map +1 -1
- package/dist/billing-section.component.js +38 -23
- package/dist/billing-section.component.js.map +1 -1
- package/dist/container-context.d.ts +7 -4
- package/dist/container-context.d.ts.map +1 -1
- package/dist/container-context.js +9 -7
- package/dist/container-context.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +2 -2
- package/dist/context.js.map +1 -1
- package/dist/controlled-switch.d.ts +0 -2
- package/dist/controlled-switch.d.ts.map +1 -1
- package/dist/controlled-switch.js +1 -6
- package/dist/controlled-switch.js.map +1 -1
- package/dist/log-out-delete-section.component.d.ts +8 -4
- package/dist/log-out-delete-section.component.d.ts.map +1 -1
- package/dist/log-out-delete-section.component.js +24 -14
- package/dist/log-out-delete-section.component.js.map +1 -1
- package/dist/tiers-upgrade-section.component.d.ts +31 -19
- package/dist/tiers-upgrade-section.component.d.ts.map +1 -1
- package/dist/tiers-upgrade-section.component.js +180 -141
- package/dist/tiers-upgrade-section.component.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthSection component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type OnInit } from '@angular/core';
|
|
1
7
|
import type { UserProfile } from '@molecule/app-auth';
|
|
2
8
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
9
|
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
4
11
|
/** The two-factor enrollment data `POST /users/:id/verify-two-factor` returns. */
|
|
5
12
|
export interface TwoFactorSetup {
|
|
6
13
|
QRImageUrl?: string;
|
|
@@ -11,9 +18,9 @@ export interface TwoFactorSetup {
|
|
|
11
18
|
* AuthSection component.
|
|
12
19
|
*
|
|
13
20
|
* Authentication section — change password (modal) + two-factor (TOTP) setup.
|
|
14
|
-
* React's root is a fragment (the `<section>` plus two modals)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
21
|
+
* React's root is a fragment (the `<section>` plus two modals) or nothing at
|
|
22
|
+
* all for an OAuth-only user (React's `return null`); those nodes render in the
|
|
23
|
+
* host's place and the host itself never appears in the page.
|
|
17
24
|
*
|
|
18
25
|
* Two-factor uses the real enrollment flow against the user resource's
|
|
19
26
|
* `POST /users/:id/verify-two-factor` endpoint (`@molecule/api-two-factor`):
|
|
@@ -25,14 +32,22 @@ export interface TwoFactorSetup {
|
|
|
25
32
|
* handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
26
33
|
*
|
|
27
34
|
* Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
28
|
-
* password / 2FA wouldn't apply.
|
|
29
|
-
* provider
|
|
35
|
+
* password / 2FA wouldn't apply. Pass `[twoFactor]="false"` when the app's API
|
|
36
|
+
* has no two-factor provider: it then serves no `verify-two-factor` route, so
|
|
37
|
+
* the section shows only the password change and reads no 2FA status.
|
|
30
38
|
*
|
|
31
39
|
* `useChangePassword`'s state is a live getter over a plain object (the
|
|
32
40
|
* Angular binding's `usePromise` port), so the pending/error reads are
|
|
33
41
|
* mediated by a version signal the handlers bump at React's re-render points.
|
|
34
42
|
*/
|
|
35
|
-
export declare class AuthSection {
|
|
43
|
+
export declare class AuthSection implements OnInit {
|
|
44
|
+
/**
|
|
45
|
+
* Show the two-factor row. Set false when the API has no two-factor provider
|
|
46
|
+
* (no `POST /users/:id/verify-two-factor` route). Default true.
|
|
47
|
+
*/
|
|
48
|
+
set twoFactor(value: boolean);
|
|
49
|
+
/** The `twoFactor` input, as a signal the template reads. */
|
|
50
|
+
protected readonly showTwoFactor: import("@angular/core").WritableSignal<boolean>;
|
|
36
51
|
/** The signed-in user (React's `useAuth().user`). */
|
|
37
52
|
protected readonly auth: import("@molecule/app-angular").UseAuthResult<UserProfile, Record<never, never>>;
|
|
38
53
|
/** Reactive translation, read in the injection context. */
|
|
@@ -67,6 +82,8 @@ export declare class AuthSection {
|
|
|
67
82
|
/** The change-password flow's error (version-mediated). */
|
|
68
83
|
protected readonly pwError: import("@angular/core").Signal<string | null>;
|
|
69
84
|
private readonly twoFactorRead;
|
|
85
|
+
private readonly host;
|
|
86
|
+
/** The section (React's `<section>` root). */
|
|
70
87
|
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
71
88
|
protected readonly cm: UIClassMap;
|
|
72
89
|
/**
|
|
@@ -79,12 +96,15 @@ export declare class AuthSection {
|
|
|
79
96
|
* @returns The title text.
|
|
80
97
|
*/
|
|
81
98
|
protected tfTitle(): string;
|
|
99
|
+
/** Places the section's content in the host's position and drops a late status read. */
|
|
100
|
+
constructor();
|
|
82
101
|
/**
|
|
83
102
|
* Reads the persisted 2FA status from `/users/me` on mount (React's mount
|
|
84
|
-
* effect); status read is best-effort and defaults
|
|
85
|
-
* that lands after unmount is dropped like React's
|
|
103
|
+
* effect), once the inputs are set; status read is best-effort and defaults
|
|
104
|
+
* to disabled. A result that lands after unmount is dropped like React's
|
|
105
|
+
* cancelled one. Without the two-factor row there is nothing to read.
|
|
86
106
|
*/
|
|
87
|
-
|
|
107
|
+
ngOnInit(): void;
|
|
88
108
|
/**
|
|
89
109
|
* Closes the change-password modal (React's `onClose`): hides it and
|
|
90
110
|
* returns the change-password flow to idle.
|
|
@@ -119,6 +139,6 @@ export declare class AuthSection {
|
|
|
119
139
|
*/
|
|
120
140
|
protected submitPassword(event: Event): Promise<void>;
|
|
121
141
|
static ɵfac: i0.ɵɵFactoryDeclaration<AuthSection, never>;
|
|
122
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AuthSection, "mol-auth-section", never, {}, {}, never, never, true,
|
|
142
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AuthSection, "mol-auth-section", never, { "twoFactor": { "alias": "twoFactor"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
123
143
|
}
|
|
124
144
|
//# sourceMappingURL=auth-section.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-section.component.d.ts","sourceRoot":"","sources":["../src/auth-section.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-section.component.d.ts","sourceRoot":"","sources":["../src/auth-section.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQL,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAA;AAYtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;;AAIlD,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAmKa,WAAY,YAAW,MAAM;IACxC;;;OAGG;IACH,IAAqB,SAAS,CAAC,KAAK,EAAE,OAAO,EAE5C;IAED,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,aAAa,kDAAe;IAE/C,qDAAqD;IACrD,SAAS,CAAC,QAAQ,CAAC,IAAI,mFAAyB;IAEhD,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,IAAI,uDAAmB;IAE1C,iDAAiD;IACjD,SAAS,CAAC,CAAC,8IAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IAEvC,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAsB;IAEzC,iDAAiD;IACjD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,kDAAgB;IACpD,0CAA0C;IAC1C,SAAS,CAAC,QAAQ,CAAC,eAAe,iDAAa;IAC/C,sCAAsC;IACtC,SAAS,CAAC,QAAQ,CAAC,WAAW,iDAAa;IAE3C,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,kDAAgB;IACnD,kEAAkE;IAClE,SAAS,CAAC,QAAQ,CAAC,OAAO,sEAA4C;IACtE,qDAAqD;IACrD,SAAS,CAAC,QAAQ,CAAC,OAAO,gEAAsC;IAChE,yCAAyC;IACzC,SAAS,CAAC,QAAQ,CAAC,OAAO,iDAAa;IACvC,+CAA+C;IAC/C,SAAS,CAAC,QAAQ,CAAC,SAAS,kDAAgB;IAC5C,4CAA4C;IAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,iDAAa;IAEvC,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,mEAAmE;IACnE,SAAS,CAAC,QAAQ,CAAC,QAAQ,kFAGzB;IAEF,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,OAAO,gDAUxB;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuB;IAErD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IAEnE,8CAA8C;IAE9C,mEAAmE;IACnE,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAgB;IAEjD;;;OAGG;IACH,SAAS,CAAC,WAAW,IAAI,OAAO;IAIhC;;;OAGG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM;IAU3B,wFAAwF;;IAcxF;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;IAkBhB;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAMpC;;OAEG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IAM/B;;;OAGG;cACa,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB5C;;;OAGG;YACW,QAAQ;IAqBtB;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK1C;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;IAOzB;;;OAGG;cACa,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;yCAvOhD,WAAW;2CAAX,WAAW;CAsPvB"}
|
|
@@ -3,18 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { Component, computed, DestroyRef, inject,
|
|
7
|
-
|
|
6
|
+
import { Component, computed, DestroyRef, ElementRef, inject,
|
|
7
|
+
// The UI kit's text field is `Input` here, so the decorator takes another name.
|
|
8
|
+
Input as InputProperty, signal, } from '@angular/core';
|
|
9
|
+
import { MolPlacement, placeContentBefore, setElementPresent, useAuth, useChangePassword, useHttpClient, usePlacement, useTranslation, } from '@molecule/app-angular';
|
|
8
10
|
import { serverErrorMessage } from '@molecule/app-http';
|
|
9
11
|
import { getClassMap } from '@molecule/app-ui';
|
|
10
12
|
import { Alert, Button, Flex, Input, Modal } from '@molecule/app-ui-angular';
|
|
11
13
|
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@molecule/app-angular";
|
|
12
15
|
const _c0 = () => ({ defaultValue: "Authentication" });
|
|
13
16
|
const _c1 = () => ({ defaultValue: "Change password" });
|
|
14
|
-
const _c2 = () => ({ defaultValue: "
|
|
15
|
-
const _c3 = () => ({ defaultValue: "
|
|
16
|
-
const _c4 = () => ({ defaultValue: "
|
|
17
|
-
const _c5 = () => ({ defaultValue: "
|
|
17
|
+
const _c2 = () => ({ defaultValue: "Change Password" });
|
|
18
|
+
const _c3 = () => ({ defaultValue: "Current Password" });
|
|
19
|
+
const _c4 = () => ({ defaultValue: "New Password" });
|
|
20
|
+
const _c5 = () => ({ defaultValue: "Two-factor authentication" });
|
|
18
21
|
const _c6 = () => ({ defaultValue: "On" });
|
|
19
22
|
const _c7 = () => ({ defaultValue: "Disable" });
|
|
20
23
|
const _c8 = () => ({ defaultValue: "Enable" });
|
|
@@ -23,42 +26,61 @@ const _c10 = () => ({ defaultValue: "Scan this QR code with your authenticator a
|
|
|
23
26
|
const _c11 = () => ({ defaultValue: "Two-factor QR code" });
|
|
24
27
|
const _c12 = () => ({ defaultValue: "Authentication code" });
|
|
25
28
|
const _c13 = () => ({ defaultValue: "Verify & enable" });
|
|
26
|
-
function
|
|
29
|
+
function AuthSection_Conditional_0_Conditional_6_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
27
30
|
i0.ɵɵelementStart(0, "span");
|
|
28
31
|
i0.ɵɵtext(1);
|
|
29
32
|
i0.ɵɵelementEnd();
|
|
30
33
|
} if (rf & 2) {
|
|
31
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
34
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
32
35
|
i0.ɵɵclassMap(ctx_r1.cm.cn(ctx_r1.cm.textSize("xs"), ctx_r1.cm.textSubtle, ctx_r1.cm.sp("ml", 2)));
|
|
33
36
|
i0.ɵɵadvance();
|
|
34
37
|
i0.ɵɵtextInterpolate(ctx_r1.t("settings.twoFactorOn", undefined, i0.ɵɵpureFunction0(3, _c6)));
|
|
35
38
|
} }
|
|
36
|
-
function
|
|
39
|
+
function AuthSection_Conditional_0_Conditional_6_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
37
40
|
const _r3 = i0.ɵɵgetCurrentView();
|
|
38
|
-
i0.ɵɵelementStart(0, "button",
|
|
39
|
-
i0.ɵɵlistener("click", function
|
|
41
|
+
i0.ɵɵelementStart(0, "button", 14);
|
|
42
|
+
i0.ɵɵlistener("click", function AuthSection_Conditional_0_Conditional_6_Conditional_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.openDisableTf()); });
|
|
40
43
|
i0.ɵɵtext(1);
|
|
41
44
|
i0.ɵɵelementEnd();
|
|
42
45
|
} if (rf & 2) {
|
|
43
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
46
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
44
47
|
i0.ɵɵproperty("variant", "outline")("size", "sm");
|
|
45
48
|
i0.ɵɵadvance();
|
|
46
49
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.twoFactorDisable", undefined, i0.ɵɵpureFunction0(3, _c7)), " ");
|
|
47
50
|
} }
|
|
48
|
-
function
|
|
51
|
+
function AuthSection_Conditional_0_Conditional_6_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
49
52
|
const _r4 = i0.ɵɵgetCurrentView();
|
|
50
|
-
i0.ɵɵelementStart(0, "button",
|
|
51
|
-
i0.ɵɵlistener("click", function
|
|
53
|
+
i0.ɵɵelementStart(0, "button", 15);
|
|
54
|
+
i0.ɵɵlistener("click", function AuthSection_Conditional_0_Conditional_6_Conditional_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.startEnable()); });
|
|
52
55
|
i0.ɵɵtext(1);
|
|
53
56
|
i0.ɵɵelementEnd();
|
|
54
57
|
} if (rf & 2) {
|
|
55
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
58
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
56
59
|
i0.ɵɵproperty("variant", "outline")("size", "sm");
|
|
57
60
|
i0.ɵɵadvance();
|
|
58
61
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.twoFactorEnable", undefined, i0.ɵɵpureFunction0(3, _c8)), " ");
|
|
59
62
|
} }
|
|
60
|
-
function
|
|
61
|
-
i0.ɵɵelementStart(0, "div",
|
|
63
|
+
function AuthSection_Conditional_0_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
64
|
+
i0.ɵɵelementStart(0, "div", 1)(1, "span");
|
|
65
|
+
i0.ɵɵtext(2);
|
|
66
|
+
i0.ɵɵconditionalCreate(3, AuthSection_Conditional_0_Conditional_6_Conditional_3_Template, 2, 4, "span", 11);
|
|
67
|
+
i0.ɵɵelementEnd();
|
|
68
|
+
i0.ɵɵconditionalCreate(4, AuthSection_Conditional_0_Conditional_6_Conditional_4_Template, 2, 4, "button", 12)(5, AuthSection_Conditional_0_Conditional_6_Conditional_5_Template, 2, 4, "button", 13);
|
|
69
|
+
i0.ɵɵelementEnd();
|
|
70
|
+
} if (rf & 2) {
|
|
71
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
72
|
+
i0.ɵɵproperty("align", "center")("justify", "between");
|
|
73
|
+
i0.ɵɵadvance();
|
|
74
|
+
i0.ɵɵclassMap(ctx_r1.cm.textSize("sm"));
|
|
75
|
+
i0.ɵɵadvance();
|
|
76
|
+
i0.ɵɵtextInterpolate(ctx_r1.t("settings.twoFactor", undefined, i0.ɵɵpureFunction0(7, _c5)));
|
|
77
|
+
i0.ɵɵadvance();
|
|
78
|
+
i0.ɵɵconditional(ctx_r1.twoFactorEnabled() ? 3 : -1);
|
|
79
|
+
i0.ɵɵadvance();
|
|
80
|
+
i0.ɵɵconditional(ctx_r1.twoFactorEnabled() ? 4 : 5);
|
|
81
|
+
} }
|
|
82
|
+
function AuthSection_Conditional_0_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
62
84
|
i0.ɵɵtext(1);
|
|
63
85
|
i0.ɵɵelementEnd();
|
|
64
86
|
} if (rf & 2) {
|
|
@@ -67,47 +89,47 @@ function AuthSection_Conditional_0_Conditional_13_Template(rf, ctx) { if (rf & 1
|
|
|
67
89
|
i0.ɵɵadvance();
|
|
68
90
|
i0.ɵɵtextInterpolate(ctx);
|
|
69
91
|
} }
|
|
70
|
-
function
|
|
92
|
+
function AuthSection_Conditional_0_Conditional_19_Template(rf, ctx) { if (rf & 1) {
|
|
71
93
|
i0.ɵɵtext(0);
|
|
72
94
|
} if (rf & 2) {
|
|
73
95
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
74
96
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.changePasswordModal.changing", undefined, i0.ɵɵpureFunction0(1, _c9)), " ");
|
|
75
97
|
} }
|
|
76
|
-
function
|
|
98
|
+
function AuthSection_Conditional_0_Conditional_20_Template(rf, ctx) { if (rf & 1) {
|
|
77
99
|
i0.ɵɵtext(0);
|
|
78
100
|
} if (rf & 2) {
|
|
79
101
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
80
102
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.changePassword", undefined, i0.ɵɵpureFunction0(1, _c1)), " ");
|
|
81
103
|
} }
|
|
82
|
-
function
|
|
83
|
-
i0.ɵɵelementStart(0, "div",
|
|
104
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
105
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
84
106
|
i0.ɵɵtext(1);
|
|
85
107
|
i0.ɵɵelementEnd();
|
|
86
108
|
} if (rf & 2) {
|
|
87
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
109
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
88
110
|
i0.ɵɵproperty("status", "error")("className", ctx_r1.cm.sp("mb", 4));
|
|
89
111
|
i0.ɵɵadvance();
|
|
90
112
|
i0.ɵɵtextInterpolate(ctx);
|
|
91
113
|
} }
|
|
92
|
-
function
|
|
114
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
93
115
|
i0.ɵɵelementStart(0, "p");
|
|
94
116
|
i0.ɵɵtext(1);
|
|
95
117
|
i0.ɵɵelementEnd();
|
|
96
118
|
} if (rf & 2) {
|
|
97
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
119
|
+
const ctx_r1 = i0.ɵɵnextContext(4);
|
|
98
120
|
i0.ɵɵclassMap(ctx_r1.cm.cn(ctx_r1.cm.textSize("xs"), ctx_r1.cm.textSubtle, ctx_r1.cm.settingsPanelTwoFactorSecret));
|
|
99
121
|
i0.ɵɵadvance();
|
|
100
122
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.tfSetup()?.secret, " ");
|
|
101
123
|
} }
|
|
102
|
-
function
|
|
124
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
103
125
|
i0.ɵɵelementStart(0, "div")(1, "p");
|
|
104
126
|
i0.ɵɵtext(2);
|
|
105
127
|
i0.ɵɵelementEnd();
|
|
106
128
|
i0.ɵɵelement(3, "img");
|
|
107
|
-
i0.ɵɵconditionalCreate(4,
|
|
129
|
+
i0.ɵɵconditionalCreate(4, AuthSection_Conditional_0_Conditional_21_Conditional_2_Conditional_4_Template, 2, 3, "p", 11);
|
|
108
130
|
i0.ɵɵelementEnd();
|
|
109
131
|
} if (rf & 2) {
|
|
110
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
132
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
111
133
|
i0.ɵɵclassMap(ctx_r1.cm.cn(ctx_r1.cm.stack(3), ctx_r1.cm.sp("mb", 4)));
|
|
112
134
|
i0.ɵɵadvance();
|
|
113
135
|
i0.ɵɵclassMap(ctx_r1.cm.cn(ctx_r1.cm.textSize("sm"), ctx_r1.cm.textMuted));
|
|
@@ -119,33 +141,33 @@ function AuthSection_Conditional_0_Conditional_28_Template(rf, ctx) { if (rf & 1
|
|
|
119
141
|
i0.ɵɵadvance();
|
|
120
142
|
i0.ɵɵconditional(ctx_r1.tfSetup()?.secret ? 4 : -1);
|
|
121
143
|
} }
|
|
122
|
-
function
|
|
144
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_3_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
123
145
|
i0.ɵɵtext(0);
|
|
124
146
|
} if (rf & 2) {
|
|
125
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
147
|
+
const ctx_r1 = i0.ɵɵnextContext(4);
|
|
126
148
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.twoFactorDisable", undefined, i0.ɵɵpureFunction0(1, _c7)), " ");
|
|
127
149
|
} }
|
|
128
|
-
function
|
|
150
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_3_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
129
151
|
i0.ɵɵtext(0);
|
|
130
152
|
} if (rf & 2) {
|
|
131
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
153
|
+
const ctx_r1 = i0.ɵɵnextContext(4);
|
|
132
154
|
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.twoFactorVerify", undefined, i0.ɵɵpureFunction0(1, _c13)), " ");
|
|
133
155
|
} }
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
i0.ɵɵelementStart(0, "form",
|
|
137
|
-
i0.ɵɵlistener("submit", function
|
|
138
|
-
i0.ɵɵelementStart(1, "div")(2, "label",
|
|
156
|
+
function AuthSection_Conditional_0_Conditional_21_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
157
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
158
|
+
i0.ɵɵelementStart(0, "form", 4);
|
|
159
|
+
i0.ɵɵlistener("submit", function AuthSection_Conditional_0_Conditional_21_Conditional_3_Template_form_submit_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.submitTfForm($event)); });
|
|
160
|
+
i0.ɵɵelementStart(1, "div")(2, "label", 16);
|
|
139
161
|
i0.ɵɵtext(3);
|
|
140
162
|
i0.ɵɵelementEnd();
|
|
141
|
-
i0.ɵɵelementStart(4, "div",
|
|
142
|
-
i0.ɵɵlistener("change", function
|
|
163
|
+
i0.ɵɵelementStart(4, "div", 17);
|
|
164
|
+
i0.ɵɵlistener("change", function AuthSection_Conditional_0_Conditional_21_Conditional_3_Template_div_change_4_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.tfToken.set($event.target.value)); });
|
|
143
165
|
i0.ɵɵelementEnd()();
|
|
144
|
-
i0.ɵɵelementStart(5, "button",
|
|
145
|
-
i0.ɵɵconditionalCreate(6,
|
|
166
|
+
i0.ɵɵelementStart(5, "button", 18);
|
|
167
|
+
i0.ɵɵconditionalCreate(6, AuthSection_Conditional_0_Conditional_21_Conditional_3_Conditional_6_Template, 1, 2)(7, AuthSection_Conditional_0_Conditional_21_Conditional_3_Conditional_7_Template, 1, 2);
|
|
146
168
|
i0.ɵɵelementEnd()();
|
|
147
169
|
} if (rf & 2) {
|
|
148
|
-
const ctx_r1 = i0.ɵɵnextContext(
|
|
170
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
149
171
|
i0.ɵɵclassMap(ctx_r1.cm.stack(4));
|
|
150
172
|
i0.ɵɵadvance(2);
|
|
151
173
|
i0.ɵɵclassMap(ctx_r1.cm.formLabel);
|
|
@@ -158,6 +180,25 @@ function AuthSection_Conditional_0_Conditional_29_Template(rf, ctx) { if (rf & 1
|
|
|
158
180
|
i0.ɵɵadvance();
|
|
159
181
|
i0.ɵɵconditional(ctx_r1.tfModal() === "disable" ? 6 : 7);
|
|
160
182
|
} }
|
|
183
|
+
function AuthSection_Conditional_0_Conditional_21_Template(rf, ctx) { if (rf & 1) {
|
|
184
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
185
|
+
i0.ɵɵelementStart(0, "mol-modal", 2);
|
|
186
|
+
i0.ɵɵlistener("close", function AuthSection_Conditional_0_Conditional_21_Template_mol_modal_close_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.closeTf()); });
|
|
187
|
+
i0.ɵɵconditionalCreate(1, AuthSection_Conditional_0_Conditional_21_Conditional_1_Template, 2, 3, "div", 3);
|
|
188
|
+
i0.ɵɵconditionalCreate(2, AuthSection_Conditional_0_Conditional_21_Conditional_2_Template, 5, 12, "div", 11);
|
|
189
|
+
i0.ɵɵconditionalCreate(3, AuthSection_Conditional_0_Conditional_21_Conditional_3_Template, 8, 13, "form", 11);
|
|
190
|
+
i0.ɵɵelementEnd();
|
|
191
|
+
} if (rf & 2) {
|
|
192
|
+
let tmp_4_0;
|
|
193
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
194
|
+
i0.ɵɵproperty("open", ctx_r1.tfModal() !== null)("title", ctx_r1.tfTitle());
|
|
195
|
+
i0.ɵɵadvance();
|
|
196
|
+
i0.ɵɵconditional((tmp_4_0 = ctx_r1.tfError()) ? 1 : -1, tmp_4_0);
|
|
197
|
+
i0.ɵɵadvance();
|
|
198
|
+
i0.ɵɵconditional(ctx_r1.tfModal() === "enable" && ctx_r1.tfSetup()?.QRImageUrl ? 2 : -1);
|
|
199
|
+
i0.ɵɵadvance();
|
|
200
|
+
i0.ɵɵconditional(ctx_r1.tfModal() === "disable" || ctx_r1.tfSetup() ? 3 : -1);
|
|
201
|
+
} }
|
|
161
202
|
function AuthSection_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
162
203
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
163
204
|
i0.ɵɵelementStart(0, "section")(1, "h3");
|
|
@@ -167,100 +208,76 @@ function AuthSection_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
167
208
|
i0.ɵɵlistener("click", function AuthSection_Conditional_0_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.showPasswordModal.set(true)); });
|
|
168
209
|
i0.ɵɵtext(5);
|
|
169
210
|
i0.ɵɵelementEnd();
|
|
170
|
-
i0.ɵɵ
|
|
171
|
-
i0.ɵɵ
|
|
172
|
-
i0.ɵɵ
|
|
173
|
-
i0.ɵɵ
|
|
174
|
-
i0.ɵɵconditionalCreate(
|
|
175
|
-
i0.ɵɵ
|
|
176
|
-
i0.ɵɵ
|
|
177
|
-
i0.ɵɵ
|
|
178
|
-
i0.ɵɵ
|
|
179
|
-
i0.ɵɵelementStart(14, "form", 7);
|
|
180
|
-
i0.ɵɵlistener("submit", function AuthSection_Conditional_0_Template_form_submit_14_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.submitPassword($event)); });
|
|
181
|
-
i0.ɵɵelementStart(15, "div")(16, "label", 8);
|
|
182
|
-
i0.ɵɵtext(17);
|
|
211
|
+
i0.ɵɵconditionalCreate(6, AuthSection_Conditional_0_Conditional_6_Template, 6, 8, "div", 1);
|
|
212
|
+
i0.ɵɵelementEnd()();
|
|
213
|
+
i0.ɵɵelementStart(7, "mol-modal", 2);
|
|
214
|
+
i0.ɵɵlistener("close", function AuthSection_Conditional_0_Template_mol_modal_close_7_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.closePasswordModal()); });
|
|
215
|
+
i0.ɵɵconditionalCreate(8, AuthSection_Conditional_0_Conditional_8_Template, 2, 3, "div", 3);
|
|
216
|
+
i0.ɵɵelementStart(9, "form", 4);
|
|
217
|
+
i0.ɵɵlistener("submit", function AuthSection_Conditional_0_Template_form_submit_9_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.submitPassword($event)); });
|
|
218
|
+
i0.ɵɵelementStart(10, "div")(11, "label", 5);
|
|
219
|
+
i0.ɵɵtext(12);
|
|
183
220
|
i0.ɵɵelementEnd();
|
|
184
|
-
i0.ɵɵelementStart(
|
|
185
|
-
i0.ɵɵlistener("change", function
|
|
221
|
+
i0.ɵɵelementStart(13, "div", 6);
|
|
222
|
+
i0.ɵɵlistener("change", function AuthSection_Conditional_0_Template_div_change_13_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.currentPassword.set($event.target.value)); });
|
|
186
223
|
i0.ɵɵelementEnd()();
|
|
187
|
-
i0.ɵɵelementStart(
|
|
188
|
-
i0.ɵɵtext(
|
|
224
|
+
i0.ɵɵelementStart(14, "div")(15, "label", 7);
|
|
225
|
+
i0.ɵɵtext(16);
|
|
189
226
|
i0.ɵɵelementEnd();
|
|
190
|
-
i0.ɵɵelementStart(
|
|
191
|
-
i0.ɵɵlistener("change", function
|
|
227
|
+
i0.ɵɵelementStart(17, "div", 8);
|
|
228
|
+
i0.ɵɵlistener("change", function AuthSection_Conditional_0_Template_div_change_17_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.newPassword.set($event.target.value)); });
|
|
192
229
|
i0.ɵɵelementEnd()();
|
|
193
|
-
i0.ɵɵelementStart(
|
|
194
|
-
i0.ɵɵconditionalCreate(
|
|
230
|
+
i0.ɵɵelementStart(18, "button", 9);
|
|
231
|
+
i0.ɵɵconditionalCreate(19, AuthSection_Conditional_0_Conditional_19_Template, 1, 2)(20, AuthSection_Conditional_0_Conditional_20_Template, 1, 2);
|
|
195
232
|
i0.ɵɵelementEnd()()();
|
|
196
|
-
i0.ɵɵ
|
|
197
|
-
i0.ɵɵlistener("close", function AuthSection_Conditional_0_Template_mol_modal_close_26_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.closeTf()); });
|
|
198
|
-
i0.ɵɵconditionalCreate(27, AuthSection_Conditional_0_Conditional_27_Template, 2, 3, "div", 6);
|
|
199
|
-
i0.ɵɵconditionalCreate(28, AuthSection_Conditional_0_Conditional_28_Template, 5, 12, "div", 2);
|
|
200
|
-
i0.ɵɵconditionalCreate(29, AuthSection_Conditional_0_Conditional_29_Template, 8, 13, "form", 2);
|
|
201
|
-
i0.ɵɵelementEnd();
|
|
233
|
+
i0.ɵɵconditionalCreate(21, AuthSection_Conditional_0_Conditional_21_Template, 4, 5, "mol-modal", 10);
|
|
202
234
|
} if (rf & 2) {
|
|
203
|
-
let
|
|
204
|
-
let tmp_32_0;
|
|
235
|
+
let tmp_10_0;
|
|
205
236
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
206
237
|
i0.ɵɵadvance();
|
|
207
238
|
i0.ɵɵclassMap(ctx_r1.cm.cn(ctx_r1.cm.sectionHeading, ctx_r1.cm.sp("mb", 3)));
|
|
208
239
|
i0.ɵɵadvance();
|
|
209
|
-
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.authentication", undefined, i0.ɵɵpureFunction0(
|
|
240
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.authentication", undefined, i0.ɵɵpureFunction0(30, _c0)), " ");
|
|
210
241
|
i0.ɵɵadvance();
|
|
211
242
|
i0.ɵɵclassMap(ctx_r1.cm.stack(3));
|
|
212
243
|
i0.ɵɵadvance();
|
|
213
244
|
i0.ɵɵproperty("variant", "outline")("size", "sm");
|
|
214
245
|
i0.ɵɵadvance();
|
|
215
|
-
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.changePassword", undefined, i0.ɵɵpureFunction0(
|
|
246
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.t("settings.changePassword", undefined, i0.ɵɵpureFunction0(31, _c1)), " ");
|
|
216
247
|
i0.ɵɵadvance();
|
|
217
|
-
i0.ɵɵ
|
|
218
|
-
i0.ɵɵadvance();
|
|
219
|
-
i0.ɵɵclassMap(ctx_r1.cm.textSize("sm"));
|
|
220
|
-
i0.ɵɵadvance();
|
|
221
|
-
i0.ɵɵtextInterpolate(ctx_r1.t("settings.twoFactor", undefined, i0.ɵɵpureFunction0(42, _c2)));
|
|
248
|
+
i0.ɵɵconditional(ctx_r1.showTwoFactor() ? 6 : -1);
|
|
222
249
|
i0.ɵɵadvance();
|
|
223
|
-
i0.ɵɵ
|
|
250
|
+
i0.ɵɵproperty("open", ctx_r1.showPasswordModal())("title", ctx_r1.t("settings.changePasswordModal.title", undefined, i0.ɵɵpureFunction0(32, _c2)));
|
|
224
251
|
i0.ɵɵadvance();
|
|
225
|
-
i0.ɵɵconditional(ctx_r1.
|
|
226
|
-
i0.ɵɵadvance(2);
|
|
227
|
-
i0.ɵɵproperty("open", ctx_r1.showPasswordModal())("title", ctx_r1.t("settings.changePasswordModal.title", undefined, i0.ɵɵpureFunction0(43, _c3)));
|
|
228
|
-
i0.ɵɵadvance();
|
|
229
|
-
i0.ɵɵconditional((tmp_15_0 = ctx_r1.pwError()) ? 13 : -1, tmp_15_0);
|
|
252
|
+
i0.ɵɵconditional((tmp_10_0 = ctx_r1.pwError()) ? 8 : -1, tmp_10_0);
|
|
230
253
|
i0.ɵɵadvance();
|
|
231
254
|
i0.ɵɵclassMap(ctx_r1.cm.stack(4));
|
|
232
255
|
i0.ɵɵadvance(2);
|
|
233
256
|
i0.ɵɵclassMap(ctx_r1.cm.formLabel);
|
|
234
257
|
i0.ɵɵadvance();
|
|
235
|
-
i0.ɵɵtextInterpolate(ctx_r1.t("settings.changePasswordModal.currentPassword", undefined, i0.ɵɵpureFunction0(
|
|
258
|
+
i0.ɵɵtextInterpolate(ctx_r1.t("settings.changePasswordModal.currentPassword", undefined, i0.ɵɵpureFunction0(33, _c3)));
|
|
236
259
|
i0.ɵɵadvance();
|
|
237
260
|
i0.ɵɵproperty("id", "current-pw")("required", true)("value", ctx_r1.currentPassword());
|
|
238
261
|
i0.ɵɵadvance(2);
|
|
239
262
|
i0.ɵɵclassMap(ctx_r1.cm.formLabel);
|
|
240
263
|
i0.ɵɵadvance();
|
|
241
|
-
i0.ɵɵtextInterpolate(ctx_r1.t("settings.changePasswordModal.newPassword", undefined, i0.ɵɵpureFunction0(
|
|
264
|
+
i0.ɵɵtextInterpolate(ctx_r1.t("settings.changePasswordModal.newPassword", undefined, i0.ɵɵpureFunction0(34, _c4)));
|
|
242
265
|
i0.ɵɵadvance();
|
|
243
266
|
i0.ɵɵproperty("id", "new-pw")("required", true)("value", ctx_r1.newPassword());
|
|
244
267
|
i0.ɵɵadvance();
|
|
245
268
|
i0.ɵɵproperty("fullWidth", true)("loading", ctx_r1.pwStatus() === "pending");
|
|
246
269
|
i0.ɵɵadvance();
|
|
247
|
-
i0.ɵɵconditional(ctx_r1.pwStatus() === "pending" ?
|
|
270
|
+
i0.ɵɵconditional(ctx_r1.pwStatus() === "pending" ? 19 : 20);
|
|
248
271
|
i0.ɵɵadvance(2);
|
|
249
|
-
i0.ɵɵ
|
|
250
|
-
i0.ɵɵadvance();
|
|
251
|
-
i0.ɵɵconditional((tmp_32_0 = ctx_r1.tfError()) ? 27 : -1, tmp_32_0);
|
|
252
|
-
i0.ɵɵadvance();
|
|
253
|
-
i0.ɵɵconditional(ctx_r1.tfModal() === "enable" && ctx_r1.tfSetup()?.QRImageUrl ? 28 : -1);
|
|
254
|
-
i0.ɵɵadvance();
|
|
255
|
-
i0.ɵɵconditional(ctx_r1.tfModal() === "disable" || ctx_r1.tfSetup() ? 29 : -1);
|
|
272
|
+
i0.ɵɵconditional(ctx_r1.showTwoFactor() ? 21 : -1);
|
|
256
273
|
} }
|
|
257
274
|
/**
|
|
258
275
|
* AuthSection component.
|
|
259
276
|
*
|
|
260
277
|
* Authentication section — change password (modal) + two-factor (TOTP) setup.
|
|
261
|
-
* React's root is a fragment (the `<section>` plus two modals)
|
|
262
|
-
*
|
|
263
|
-
*
|
|
278
|
+
* React's root is a fragment (the `<section>` plus two modals) or nothing at
|
|
279
|
+
* all for an OAuth-only user (React's `return null`); those nodes render in the
|
|
280
|
+
* host's place and the host itself never appears in the page.
|
|
264
281
|
*
|
|
265
282
|
* Two-factor uses the real enrollment flow against the user resource's
|
|
266
283
|
* `POST /users/:id/verify-two-factor` endpoint (`@molecule/api-two-factor`):
|
|
@@ -272,14 +289,25 @@ function AuthSection_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
272
289
|
* handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
273
290
|
*
|
|
274
291
|
* Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
275
|
-
* password / 2FA wouldn't apply.
|
|
276
|
-
* provider
|
|
292
|
+
* password / 2FA wouldn't apply. Pass `[twoFactor]="false"` when the app's API
|
|
293
|
+
* has no two-factor provider: it then serves no `verify-two-factor` route, so
|
|
294
|
+
* the section shows only the password change and reads no 2FA status.
|
|
277
295
|
*
|
|
278
296
|
* `useChangePassword`'s state is a live getter over a plain object (the
|
|
279
297
|
* Angular binding's `usePromise` port), so the pending/error reads are
|
|
280
298
|
* mediated by a version signal the handlers bump at React's re-render points.
|
|
281
299
|
*/
|
|
282
300
|
export class AuthSection {
|
|
301
|
+
/**
|
|
302
|
+
* Show the two-factor row. Set false when the API has no two-factor provider
|
|
303
|
+
* (no `POST /users/:id/verify-two-factor` route). Default true.
|
|
304
|
+
*/
|
|
305
|
+
set twoFactor(value) {
|
|
306
|
+
this.showTwoFactor.set(value);
|
|
307
|
+
}
|
|
308
|
+
/** The `twoFactor` input, as a signal the template reads. */
|
|
309
|
+
showTwoFactor = signal(true, /* @ts-ignore */
|
|
310
|
+
...(ngDevMode ? [{ debugName: "showTwoFactor" }] : /* istanbul ignore next */ []));
|
|
283
311
|
/** The signed-in user (React's `useAuth().user`). */
|
|
284
312
|
auth = useAuth();
|
|
285
313
|
/** Reactive translation, read in the injection context. */
|
|
@@ -338,6 +366,8 @@ export class AuthSection {
|
|
|
338
366
|
}, /* @ts-ignore */
|
|
339
367
|
...(ngDevMode ? [{ debugName: "pwError" }] : /* istanbul ignore next */ []));
|
|
340
368
|
twoFactorRead = { cancelled: false };
|
|
369
|
+
host = inject(ElementRef);
|
|
370
|
+
/** The section (React's `<section>` root). */
|
|
341
371
|
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
342
372
|
cm = getClassMap();
|
|
343
373
|
/**
|
|
@@ -360,16 +390,29 @@ export class AuthSection {
|
|
|
360
390
|
defaultValue: 'Enable two-factor authentication',
|
|
361
391
|
});
|
|
362
392
|
}
|
|
363
|
-
/**
|
|
364
|
-
* Reads the persisted 2FA status from `/users/me` on mount (React's mount
|
|
365
|
-
* effect); status read is best-effort and defaults to disabled. A result
|
|
366
|
-
* that lands after unmount is dropped like React's cancelled one.
|
|
367
|
-
*/
|
|
393
|
+
/** Places the section's content in the host's position and drops a late status read. */
|
|
368
394
|
constructor() {
|
|
395
|
+
usePlacement(() => {
|
|
396
|
+
// React's fragment (the section plus two modals) or nothing: the whole
|
|
397
|
+
// template renders in the host's place and the host leaves the page.
|
|
398
|
+
placeContentBefore(this.host.nativeElement, this.host.nativeElement);
|
|
399
|
+
setElementPresent(this.host.nativeElement, false);
|
|
400
|
+
});
|
|
369
401
|
const read = this.twoFactorRead;
|
|
370
402
|
inject(DestroyRef).onDestroy(() => {
|
|
371
403
|
read.cancelled = true;
|
|
372
404
|
});
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Reads the persisted 2FA status from `/users/me` on mount (React's mount
|
|
408
|
+
* effect), once the inputs are set; status read is best-effort and defaults
|
|
409
|
+
* to disabled. A result that lands after unmount is dropped like React's
|
|
410
|
+
* cancelled one. Without the two-factor row there is nothing to read.
|
|
411
|
+
*/
|
|
412
|
+
ngOnInit() {
|
|
413
|
+
if (!this.showTwoFactor())
|
|
414
|
+
return;
|
|
415
|
+
const read = this.twoFactorRead;
|
|
373
416
|
void this.http
|
|
374
417
|
.get('/api/users/me')
|
|
375
418
|
.then((res) => {
|
|
@@ -489,8 +532,8 @@ export class AuthSection {
|
|
|
489
532
|
}
|
|
490
533
|
}
|
|
491
534
|
static ɵfac = function AuthSection_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AuthSection)(); };
|
|
492
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthSection, selectors: [["mol-auth-section"]],
|
|
493
|
-
i0.ɵɵconditionalCreate(0, AuthSection_Conditional_0_Template,
|
|
535
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthSection, selectors: [["mol-auth-section"]], inputs: { twoFactor: "twoFactor" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], decls: 1, vars: 1, consts: [["mol-button", "", 3, "click", "variant", "size"], ["mol-flex", "", 3, "align", "justify"], [3, "close", "open", "title"], ["mol-alert", "", 3, "status", "className"], [3, "submit"], ["for", "current-pw"], ["mol-input", "", "type", "password", "autocomplete", "current-password", 3, "change", "id", "required", "value"], ["for", "new-pw"], ["mol-input", "", "type", "password", "autocomplete", "new-password", 3, "change", "id", "required", "value"], ["mol-button", "", "type", "submit", 3, "fullWidth", "loading"], [3, "open", "title"], [3, "class"], ["mol-button", "", "data-mol-id", "two-factor-disable", 3, "variant", "size"], ["mol-button", "", "data-mol-id", "two-factor-enable", 3, "variant", "size"], ["mol-button", "", "data-mol-id", "two-factor-disable", 3, "click", "variant", "size"], ["mol-button", "", "data-mol-id", "two-factor-enable", 3, "click", "variant", "size"], ["for", "tf-token"], ["mol-input", "", "type", "text", "autocomplete", "one-time-code", 3, "change", "id", "required", "value"], ["mol-button", "", "type", "submit", 3, "color", "fullWidth", "loading"]], template: function AuthSection_Template(rf, ctx) { if (rf & 1) {
|
|
536
|
+
i0.ɵɵconditionalCreate(0, AuthSection_Conditional_0_Template, 22, 35);
|
|
494
537
|
} if (rf & 2) {
|
|
495
538
|
i0.ɵɵconditional(!ctx.isOauthOnly() ? 0 : -1);
|
|
496
539
|
} }, dependencies: [Alert, Button, Flex, Input, Modal], encapsulation: 2 });
|
|
@@ -500,14 +543,10 @@ export class AuthSection {
|
|
|
500
543
|
args: [{
|
|
501
544
|
selector: 'mol-auth-section',
|
|
502
545
|
standalone: true,
|
|
546
|
+
hostDirectives: [MolPlacement],
|
|
503
547
|
imports: [Alert, Button, Flex, Input, Modal],
|
|
504
|
-
host: {
|
|
505
|
-
'data-parity-unwrap': '',
|
|
506
|
-
style: 'display: contents',
|
|
507
|
-
},
|
|
508
548
|
// prettier-ignore
|
|
509
|
-
template: `@if (!isOauthOnly()) {
|
|
510
|
-
<section>
|
|
549
|
+
template: `@if (!isOauthOnly()) {<section>
|
|
511
550
|
<h3 [class]="cm.cn(cm.sectionHeading, cm.sp('mb', 3))">
|
|
512
551
|
{{ t('settings.authentication', undefined, { defaultValue: 'Authentication' }) }}
|
|
513
552
|
</h3>
|
|
@@ -520,6 +559,7 @@ export class AuthSection {
|
|
|
520
559
|
>
|
|
521
560
|
{{ t('settings.changePassword', undefined, { defaultValue: 'Change password' }) }}
|
|
522
561
|
</button>
|
|
562
|
+
@if (showTwoFactor()) {
|
|
523
563
|
<div mol-flex [align]="'center'" [justify]="'between'">
|
|
524
564
|
<span [class]="cm.textSize('sm')">{{ t('settings.twoFactor', undefined, { defaultValue: 'Two-factor authentication' }) }}@if (twoFactorEnabled()) {<span [class]="cm.cn(cm.textSize('xs'), cm.textSubtle, cm.sp('ml', 2))">{{ t('settings.twoFactorOn', undefined, { defaultValue: 'On' }) }}</span>}</span>
|
|
525
565
|
@if (twoFactorEnabled()) {
|
|
@@ -544,6 +584,7 @@ export class AuthSection {
|
|
|
544
584
|
</button>
|
|
545
585
|
}
|
|
546
586
|
</div>
|
|
587
|
+
}
|
|
547
588
|
</div>
|
|
548
589
|
</section>
|
|
549
590
|
<mol-modal
|
|
@@ -600,6 +641,7 @@ export class AuthSection {
|
|
|
600
641
|
</button>
|
|
601
642
|
</form>
|
|
602
643
|
</mol-modal>
|
|
644
|
+
@if (showTwoFactor()) {
|
|
603
645
|
<mol-modal [open]="tfModal() !== null" (close)="closeTf()" [title]="tfTitle()">
|
|
604
646
|
@if (tfError(); as tfFailure) {
|
|
605
647
|
<div mol-alert [status]="'error'" [className]="cm.sp('mb', 4)">{{ tfFailure }}</div>
|
|
@@ -659,9 +701,10 @@ export class AuthSection {
|
|
|
659
701
|
</button>
|
|
660
702
|
</form>
|
|
661
703
|
}
|
|
662
|
-
</mol-modal>
|
|
663
|
-
}`,
|
|
704
|
+
</mol-modal>}}`,
|
|
664
705
|
}]
|
|
665
|
-
}], () => [],
|
|
666
|
-
|
|
706
|
+
}], () => [], { twoFactor: [{
|
|
707
|
+
type: InputProperty
|
|
708
|
+
}] }); })();
|
|
709
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AuthSection, { className: "AuthSection", filePath: "auth-section.component.ts", lineNumber: 231 }); })();
|
|
667
710
|
//# sourceMappingURL=auth-section.component.js.map
|