@getauthui/core 0.1.11 → 0.1.12
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 +3 -3
- package/dist/{authui-user-button-BErNabVH.js → authui-user-button--QfXbaC8.js} +300 -227
- package/dist/authui.cdn.js +259 -211
- package/dist/authui.cdn.mjs +629 -556
- package/dist/authui.js +2 -2
- package/dist/components/authui-account.d.ts +7 -0
- package/dist/components/authui-account.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { state as c, property as m, customElement as
|
|
2
|
-
import { css as
|
|
1
|
+
import { state as c, property as m, customElement as L, query as at } from "lit/decorators.js";
|
|
2
|
+
import { css as T, LitElement as nt, nothing as n, html as r, svg as u } from "lit";
|
|
3
3
|
import { Client as ct, Account as dt, Teams as kt, ID as W, Avatars as Ct } from "appwrite";
|
|
4
4
|
const St = {
|
|
5
5
|
signIn: "Sign in",
|
|
@@ -79,7 +79,7 @@ const St = {
|
|
|
79
79
|
twoFactor: "Two-factor authentication",
|
|
80
80
|
mfaBadge: "MFA",
|
|
81
81
|
twoFactorDescription: "Require a second factor when signing in to this account.",
|
|
82
|
-
mfaNoFactorWarning: "
|
|
82
|
+
mfaNoFactorWarning: "Two-factor authentication is on, but no factors are set up yet. Add an authenticator, or verify your email or phone. Without a factor, this setting does not protect the account.",
|
|
83
83
|
enable: "Enable",
|
|
84
84
|
disable: "Disable",
|
|
85
85
|
authenticatorApp: "Authenticator app",
|
|
@@ -248,13 +248,13 @@ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
248
248
|
"juniper",
|
|
249
249
|
"kite",
|
|
250
250
|
"lumen"
|
|
251
|
-
], ht = () => `${G[Math.floor(Math.random() * G.length)]}-${G[Math.floor(Math.random() * G.length)]}`, D = () => Math.random().toString(36).slice(2, 12), ut = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"),
|
|
251
|
+
], ht = () => `${G[Math.floor(Math.random() * G.length)]}-${G[Math.floor(Math.random() * G.length)]}`, D = () => Math.random().toString(36).slice(2, 12), ut = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), Ut = {
|
|
252
252
|
name: "Ada Lovelace",
|
|
253
253
|
email: "ada@example.com",
|
|
254
254
|
phone: "+15550100"
|
|
255
255
|
};
|
|
256
256
|
class It {
|
|
257
|
-
constructor(t =
|
|
257
|
+
constructor(t = Ut) {
|
|
258
258
|
this.seed = t, this.user = null, this.mfaPending = !1, this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], this.lastChallenge = 0, this.sessions = [], this.identities = [], this.logs = [], this.tokens = /* @__PURE__ */ new Map(), this.pendingAuthenticator = null;
|
|
259
259
|
}
|
|
260
260
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -591,7 +591,7 @@ class It {
|
|
|
591
591
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Et(e) {
|
|
595
595
|
let t = 2166136261;
|
|
596
596
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
597
597
|
for (const g of e) t = (t ^ g.charCodeAt(0)) * 16777619;
|
|
@@ -760,7 +760,7 @@ function $t() {
|
|
|
760
760
|
} catch {
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function ft() {
|
|
764
764
|
if (!(typeof sessionStorage > "u"))
|
|
765
765
|
try {
|
|
766
766
|
sessionStorage.removeItem(Z);
|
|
@@ -777,7 +777,7 @@ function A(e, t, i) {
|
|
|
777
777
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
778
778
|
);
|
|
779
779
|
}
|
|
780
|
-
const it = "authui",
|
|
780
|
+
const it = "authui", mt = ["userId", "secret", "expire", "project", "error", it], gt = () => ({
|
|
781
781
|
status: "loading",
|
|
782
782
|
user: null,
|
|
783
783
|
mfaFactors: null,
|
|
@@ -785,7 +785,7 @@ const it = "authui", ft = ["userId", "secret", "expire", "project", "error", it]
|
|
|
785
785
|
configured: !1,
|
|
786
786
|
configError: null
|
|
787
787
|
});
|
|
788
|
-
class
|
|
788
|
+
class Tt {
|
|
789
789
|
constructor() {
|
|
790
790
|
this.client = null, this.account = null, this.config = null, this.state = gt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
791
791
|
}
|
|
@@ -1332,7 +1332,7 @@ class Lt {
|
|
|
1332
1332
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1333
1333
|
redirectUrl(t) {
|
|
1334
1334
|
const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
|
|
1335
|
-
for (const a of
|
|
1335
|
+
for (const a of mt) s.searchParams.delete(a);
|
|
1336
1336
|
return s.searchParams.set(it, t), s.toString();
|
|
1337
1337
|
}
|
|
1338
1338
|
setPending(t) {
|
|
@@ -1361,10 +1361,10 @@ class Lt {
|
|
|
1361
1361
|
switch (i) {
|
|
1362
1362
|
case "oauth":
|
|
1363
1363
|
case "magic-url":
|
|
1364
|
-
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? $t() : _("magic-url")) : (i === "oauth" &&
|
|
1364
|
+
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? $t() : _("magic-url")) : (i === "oauth" && ft(), h());
|
|
1365
1365
|
break;
|
|
1366
1366
|
case "oauth-failed":
|
|
1367
|
-
|
|
1367
|
+
ft(), this.setState({
|
|
1368
1368
|
pending: {
|
|
1369
1369
|
type: "notice",
|
|
1370
1370
|
tone: "error",
|
|
@@ -1397,7 +1397,7 @@ class Lt {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
cleanUrl() {
|
|
1399
1399
|
const t = new URL(window.location.href);
|
|
1400
|
-
for (const i of
|
|
1400
|
+
for (const i of mt) t.searchParams.delete(i);
|
|
1401
1401
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1402
1402
|
}
|
|
1403
1403
|
/** Test helper. */
|
|
@@ -1405,7 +1405,7 @@ class Lt {
|
|
|
1405
1405
|
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = gt(), this.listeners.clear();
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
|
-
const
|
|
1408
|
+
const l = new Tt();
|
|
1409
1409
|
class Rt {
|
|
1410
1410
|
constructor() {
|
|
1411
1411
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
@@ -1441,7 +1441,7 @@ const vt = new Rt(), bt = {
|
|
|
1441
1441
|
lg: "0.875rem",
|
|
1442
1442
|
xl: "1.125rem",
|
|
1443
1443
|
full: "1.5rem"
|
|
1444
|
-
},
|
|
1444
|
+
}, Lt = T`
|
|
1445
1445
|
:host {
|
|
1446
1446
|
/* Light theme (matches :root in the console) */
|
|
1447
1447
|
--authui-background: oklch(1 0 0);
|
|
@@ -1519,7 +1519,7 @@ const vt = new Rt(), bt = {
|
|
|
1519
1519
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1520
1520
|
color-scheme: dark;
|
|
1521
1521
|
}
|
|
1522
|
-
`, Dt =
|
|
1522
|
+
`, Dt = T`
|
|
1523
1523
|
*,
|
|
1524
1524
|
*::before,
|
|
1525
1525
|
*::after {
|
|
@@ -2529,12 +2529,12 @@ var zt = Object.defineProperty, _t = (e, t, i, s) => {
|
|
|
2529
2529
|
}, O;
|
|
2530
2530
|
const xt = (O = class extends nt {
|
|
2531
2531
|
constructor() {
|
|
2532
|
-
super(...arguments), this.auth =
|
|
2532
|
+
super(...arguments), this.auth = l.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2533
2533
|
}
|
|
2534
2534
|
connectedCallback() {
|
|
2535
2535
|
super.connectedCallback();
|
|
2536
2536
|
for (const t of O.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2537
|
-
this.auth =
|
|
2537
|
+
this.auth = l.getState(), this.unsubscribeStore = l.on("change", (t) => {
|
|
2538
2538
|
this.auth = t, this.applyBranding();
|
|
2539
2539
|
}), this.unsubscribeTheme = vt.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2540
2540
|
}
|
|
@@ -2544,14 +2544,14 @@ const xt = (O = class extends nt {
|
|
|
2544
2544
|
this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
|
|
2545
2545
|
}
|
|
2546
2546
|
get strings() {
|
|
2547
|
-
return
|
|
2547
|
+
return l.getStrings();
|
|
2548
2548
|
}
|
|
2549
2549
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2550
2550
|
t(t, i) {
|
|
2551
2551
|
return At(this.strings[t], i);
|
|
2552
2552
|
}
|
|
2553
2553
|
get config() {
|
|
2554
|
-
return
|
|
2554
|
+
return l.getConfig();
|
|
2555
2555
|
}
|
|
2556
2556
|
get productName() {
|
|
2557
2557
|
return this.config?.branding?.name ?? "";
|
|
@@ -2568,11 +2568,11 @@ const xt = (O = class extends nt {
|
|
|
2568
2568
|
fire(t, i) {
|
|
2569
2569
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2570
2570
|
}
|
|
2571
|
-
}, O.styles = [
|
|
2571
|
+
}, O.styles = [Lt, Dt], O.KEY_EVENTS = ["keydown", "keyup", "keypress"], O);
|
|
2572
2572
|
_t([
|
|
2573
2573
|
c()
|
|
2574
2574
|
], xt.prototype, "auth");
|
|
2575
|
-
let
|
|
2575
|
+
let E = xt;
|
|
2576
2576
|
var qt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, x = (e, t, i, s) => {
|
|
2577
2577
|
for (var a = s > 1 ? void 0 : s ? Vt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
2578
2578
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
@@ -2591,12 +2591,12 @@ let w = class extends nt {
|
|
|
2591
2591
|
configure() {
|
|
2592
2592
|
if (!this.endpoint || !this.project) {
|
|
2593
2593
|
queueMicrotask(() => {
|
|
2594
|
-
(!this.endpoint || !this.project) &&
|
|
2594
|
+
(!this.endpoint || !this.project) && l.notifyConfigIncomplete();
|
|
2595
2595
|
});
|
|
2596
2596
|
return;
|
|
2597
2597
|
}
|
|
2598
|
-
const e = this.toConfig(), t =
|
|
2599
|
-
t && JSON.stringify(t) === JSON.stringify(e) ||
|
|
2598
|
+
const e = this.toConfig(), t = l.getConfig();
|
|
2599
|
+
t && JSON.stringify(t) === JSON.stringify(e) || l.configure(e);
|
|
2600
2600
|
}
|
|
2601
2601
|
toConfig() {
|
|
2602
2602
|
const e = { oauth: [] }, t = this.methods.split(/[\s,]+/).filter(Boolean);
|
|
@@ -2629,7 +2629,7 @@ let w = class extends nt {
|
|
|
2629
2629
|
};
|
|
2630
2630
|
}
|
|
2631
2631
|
};
|
|
2632
|
-
w.styles =
|
|
2632
|
+
w.styles = T`
|
|
2633
2633
|
:host {
|
|
2634
2634
|
display: none;
|
|
2635
2635
|
}
|
|
@@ -2695,7 +2695,7 @@ x([
|
|
|
2695
2695
|
m({ type: String })
|
|
2696
2696
|
], w.prototype, "preview", 2);
|
|
2697
2697
|
w = x([
|
|
2698
|
-
|
|
2698
|
+
L("authui-config")
|
|
2699
2699
|
], w);
|
|
2700
2700
|
var Nt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Q = (e, t, i, s) => {
|
|
2701
2701
|
for (var a = s > 1 ? void 0 : s ? Bt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
@@ -2732,10 +2732,10 @@ function Wt(e, t, i) {
|
|
|
2732
2732
|
}
|
|
2733
2733
|
let H = class extends nt {
|
|
2734
2734
|
constructor() {
|
|
2735
|
-
super(...arguments), this.when = "", this.unless = "", this.status =
|
|
2735
|
+
super(...arguments), this.when = "", this.unless = "", this.status = l.getState().status, this.unsubscribe = null;
|
|
2736
2736
|
}
|
|
2737
2737
|
connectedCallback() {
|
|
2738
|
-
super.connectedCallback(), this.status =
|
|
2738
|
+
super.connectedCallback(), this.status = l.getState().status, this.unsubscribe = l.on("change", (e) => this.status = e.status);
|
|
2739
2739
|
}
|
|
2740
2740
|
disconnectedCallback() {
|
|
2741
2741
|
super.disconnectedCallback(), this.unsubscribe?.(), this.unsubscribe = null;
|
|
@@ -2761,9 +2761,9 @@ Q([
|
|
|
2761
2761
|
c()
|
|
2762
2762
|
], H.prototype, "status", 2);
|
|
2763
2763
|
H = Q([
|
|
2764
|
-
|
|
2764
|
+
L("authui-show")
|
|
2765
2765
|
], H);
|
|
2766
|
-
const Kt =
|
|
2766
|
+
const Kt = T`
|
|
2767
2767
|
:host {
|
|
2768
2768
|
display: block;
|
|
2769
2769
|
width: 100%;
|
|
@@ -2828,7 +2828,7 @@ const Kt = L`
|
|
|
2828
2828
|
aria-hidden="true"
|
|
2829
2829
|
>
|
|
2830
2830
|
${e}
|
|
2831
|
-
</svg>`,
|
|
2831
|
+
</svg>`, o = {
|
|
2832
2832
|
mail: b(
|
|
2833
2833
|
u`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`
|
|
2834
2834
|
),
|
|
@@ -2967,11 +2967,11 @@ const Kt = L`
|
|
|
2967
2967
|
)
|
|
2968
2968
|
};
|
|
2969
2969
|
function B(e) {
|
|
2970
|
-
return Gt[e] ??
|
|
2970
|
+
return Gt[e] ?? o.globe;
|
|
2971
2971
|
}
|
|
2972
2972
|
function lt(e) {
|
|
2973
2973
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
2974
|
-
return /[A-Z0-9]/i.test(t) ? t :
|
|
2974
|
+
return /[A-Z0-9]/i.test(t) ? t : o.user;
|
|
2975
2975
|
}
|
|
2976
2976
|
function X(e) {
|
|
2977
2977
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
@@ -3002,19 +3002,19 @@ var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, k = (e, t,
|
|
|
3002
3002
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3003
3003
|
return s && a && Yt(t, i, a), a;
|
|
3004
3004
|
};
|
|
3005
|
-
let $ = class extends
|
|
3005
|
+
let $ = class extends E {
|
|
3006
3006
|
constructor() {
|
|
3007
3007
|
super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3008
3008
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3009
|
-
await
|
|
3009
|
+
await l.signInWithEmailPassword(this.email, this.password), this.password = "", _("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
3010
3010
|
});
|
|
3011
3011
|
}, this.onSignUp = (e) => {
|
|
3012
3012
|
e.preventDefault(), this.requireValid(e) && (this.legalErrorFromOAuth = !1, this.ensureLegalAccepted() && this.run(async () => {
|
|
3013
|
-
await
|
|
3013
|
+
await l.signUp(this.email, this.password, this.name), this.password = "", _("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
3014
3014
|
}));
|
|
3015
3015
|
}, this.onGuest = () => {
|
|
3016
3016
|
this.run(async () => {
|
|
3017
|
-
await
|
|
3017
|
+
await l.signInAnonymously(), _("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
3018
3018
|
});
|
|
3019
3019
|
}, this.onOAuth = (e) => {
|
|
3020
3020
|
if (this.step === "sign-up" && !this.ensureLegalAccepted()) {
|
|
@@ -3022,7 +3022,7 @@ let $ = class extends U {
|
|
|
3022
3022
|
return;
|
|
3023
3023
|
}
|
|
3024
3024
|
this.legalErrorFromOAuth = !1, this.run(async () => {
|
|
3025
|
-
if (Ft(e), await
|
|
3025
|
+
if (Ft(e), await l.signInWithOAuth(e), l.isPreview) {
|
|
3026
3026
|
$t(), this.fire("authui-success", { method: "oauth" });
|
|
3027
3027
|
return;
|
|
3028
3028
|
}
|
|
@@ -3030,7 +3030,7 @@ let $ = class extends U {
|
|
|
3030
3030
|
});
|
|
3031
3031
|
}, this.onForgot = (e) => {
|
|
3032
3032
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3033
|
-
await
|
|
3033
|
+
await l.sendPasswordRecovery(this.email), this.notice = { tone: "success", message: this.t("resetLinkSent", { email: this.email }) };
|
|
3034
3034
|
});
|
|
3035
3035
|
}, this.onReset = (e) => {
|
|
3036
3036
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
@@ -3040,11 +3040,11 @@ let $ = class extends U {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
const t = this.recovery;
|
|
3042
3042
|
t && this.run(async () => {
|
|
3043
|
-
await
|
|
3043
|
+
await l.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.auth.pending?.type === "reset-password" && l.setPending(null), this.go("sign-in"), this.notice = { tone: "success", message: this.t("passwordUpdated") };
|
|
3044
3044
|
});
|
|
3045
3045
|
}, this.onMagicUrl = (e) => {
|
|
3046
3046
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3047
|
-
const t = await
|
|
3047
|
+
const t = await l.sendMagicUrl(this.email);
|
|
3048
3048
|
this.token = {
|
|
3049
3049
|
userId: t.userId,
|
|
3050
3050
|
kind: "magic-url",
|
|
@@ -3054,7 +3054,7 @@ let $ = class extends U {
|
|
|
3054
3054
|
});
|
|
3055
3055
|
}, this.onEmailOtp = (e) => {
|
|
3056
3056
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3057
|
-
const t = await
|
|
3057
|
+
const t = await l.sendEmailOtp(this.email);
|
|
3058
3058
|
this.token = {
|
|
3059
3059
|
userId: t.userId,
|
|
3060
3060
|
kind: "email-otp",
|
|
@@ -3064,37 +3064,37 @@ let $ = class extends U {
|
|
|
3064
3064
|
});
|
|
3065
3065
|
}, this.onPhoneOtp = (e) => {
|
|
3066
3066
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3067
|
-
const t = await
|
|
3067
|
+
const t = await l.sendPhoneOtp(this.phone);
|
|
3068
3068
|
this.token = { userId: t.userId, kind: "phone", target: this.phone }, this.code = "", this.resendCooldownUntil = Date.now() + 3e4, window.setTimeout(() => this.requestUpdate(), 3e4);
|
|
3069
3069
|
});
|
|
3070
3070
|
}, this.onVerifyCode = (e) => {
|
|
3071
3071
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3072
3072
|
const t = this.token;
|
|
3073
3073
|
t && this.run(async () => {
|
|
3074
|
-
await
|
|
3074
|
+
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null, _(t.kind), this.fire("authui-success", { method: t.kind });
|
|
3075
3075
|
}, "code");
|
|
3076
3076
|
}, this.onChooseFactor = (e) => {
|
|
3077
3077
|
this.run(async () => {
|
|
3078
|
-
const t = await
|
|
3078
|
+
const t = await l.createMfaChallenge(e);
|
|
3079
3079
|
this.challenge = { id: t.$id, factor: e }, this.code = "";
|
|
3080
3080
|
});
|
|
3081
3081
|
}, this.onVerifyFactor = (e) => {
|
|
3082
3082
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3083
3083
|
const t = this.challenge;
|
|
3084
3084
|
t && this.run(async () => {
|
|
3085
|
-
await
|
|
3085
|
+
await l.completeMfaChallenge(t.id, this.code), this.code = "", this.challenge = null, this.go("sign-in"), this.fire("authui-success", { method: "mfa" });
|
|
3086
3086
|
}, "code");
|
|
3087
3087
|
}, this.onCancelMfa = () => {
|
|
3088
3088
|
this.run(async () => {
|
|
3089
3089
|
try {
|
|
3090
|
-
await
|
|
3090
|
+
await l.signOut();
|
|
3091
3091
|
} catch (e) {
|
|
3092
3092
|
if (!j(e, v.sessionNotFound)) throw e;
|
|
3093
3093
|
}
|
|
3094
3094
|
this.go("sign-in");
|
|
3095
3095
|
});
|
|
3096
3096
|
}, this.onSignOut = () => {
|
|
3097
|
-
this.run(() =>
|
|
3097
|
+
this.run(() => l.signOut());
|
|
3098
3098
|
};
|
|
3099
3099
|
}
|
|
3100
3100
|
connectedCallback() {
|
|
@@ -3118,7 +3118,7 @@ let $ = class extends U {
|
|
|
3118
3118
|
}
|
|
3119
3119
|
/** Navigate between screens and reset transient state. */
|
|
3120
3120
|
dismissNotice() {
|
|
3121
|
-
this.notice = null, this.auth.pending?.type === "notice" &&
|
|
3121
|
+
this.notice = null, this.auth.pending?.type === "notice" && l.setPending(null);
|
|
3122
3122
|
}
|
|
3123
3123
|
go(e) {
|
|
3124
3124
|
e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.showPasswordConfirm = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
|
|
@@ -3153,14 +3153,14 @@ let $ = class extends U {
|
|
|
3153
3153
|
<div class="panel ${this.embedded ? "embedded" : ""}" part="panel">
|
|
3154
3154
|
${this.renderHeader()}
|
|
3155
3155
|
${this.notice ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
3156
|
-
${this.notice.tone === "success" ?
|
|
3156
|
+
${this.notice.tone === "success" ? o.checkCircle : this.notice.tone === "error" ? o.alert : o.info}
|
|
3157
3157
|
<div class="alert-body">${this.notice.message}</div>
|
|
3158
3158
|
<button
|
|
3159
3159
|
class="btn btn-ghost btn-icon dismiss"
|
|
3160
3160
|
@click=${() => this.dismissNotice()}
|
|
3161
3161
|
aria-label=${this.t("close")}
|
|
3162
3162
|
>
|
|
3163
|
-
${
|
|
3163
|
+
${o.x}
|
|
3164
3164
|
</button>
|
|
3165
3165
|
</div>` : n}
|
|
3166
3166
|
${e}
|
|
@@ -3205,7 +3205,7 @@ let $ = class extends U {
|
|
|
3205
3205
|
a.target.hidden = !0;
|
|
3206
3206
|
}}
|
|
3207
3207
|
/>` : n}
|
|
3208
|
-
${
|
|
3208
|
+
${l.isPreview ? r`<span class="badge badge-info preview">${this.t("preview")}</span>` : n}
|
|
3209
3209
|
<h2 class="title" id="authui-title">${i}</h2>
|
|
3210
3210
|
${s ? r`<p class="description">${s}</p>` : n}
|
|
3211
3211
|
</div>
|
|
@@ -3213,7 +3213,7 @@ let $ = class extends U {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
renderError() {
|
|
3215
3215
|
return this.error ? r`<div class="alert alert-error" role="alert">
|
|
3216
|
-
${
|
|
3216
|
+
${o.alert}
|
|
3217
3217
|
<div class="alert-body">${this.error}</div>
|
|
3218
3218
|
</div>` : n;
|
|
3219
3219
|
}
|
|
@@ -3255,7 +3255,7 @@ let $ = class extends U {
|
|
|
3255
3255
|
}}
|
|
3256
3256
|
aria-label=${i ? this.t("hidePassword") : this.t("showPassword")}
|
|
3257
3257
|
>
|
|
3258
|
-
${i ?
|
|
3258
|
+
${i ? o.eyeOff : o.eye}
|
|
3259
3259
|
</button>
|
|
3260
3260
|
</div>
|
|
3261
3261
|
${s && t ? r`<div class="strength" aria-live="polite">
|
|
@@ -3345,19 +3345,19 @@ let $ = class extends U {
|
|
|
3345
3345
|
backLink(e = "sign-in") {
|
|
3346
3346
|
return r`<div class="links">
|
|
3347
3347
|
<button type="button" class="btn btn-link" @click=${() => this.go(e)}>
|
|
3348
|
-
${
|
|
3348
|
+
${o.arrowLeft} ${this.t("back")}
|
|
3349
3349
|
</button>
|
|
3350
3350
|
</div>`;
|
|
3351
3351
|
}
|
|
3352
3352
|
renderStep() {
|
|
3353
3353
|
if (this.auth.configError)
|
|
3354
3354
|
return r`<div class="alert alert-error" role="alert">
|
|
3355
|
-
${
|
|
3355
|
+
${o.alert}
|
|
3356
3356
|
<div class="alert-body">${this.auth.configError}</div>
|
|
3357
3357
|
</div>`;
|
|
3358
3358
|
if (!this.auth.configured)
|
|
3359
3359
|
return r`<div class="alert alert-error" role="alert">
|
|
3360
|
-
${
|
|
3360
|
+
${o.alert}
|
|
3361
3361
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
3362
3362
|
</div>`;
|
|
3363
3363
|
if (this.auth.status === "loading")
|
|
@@ -3406,10 +3406,10 @@ let $ = class extends U {
|
|
|
3406
3406
|
this.embedded ? this.fire("authui-open", { view: "account" }) : X("account");
|
|
3407
3407
|
}}
|
|
3408
3408
|
>
|
|
3409
|
-
${
|
|
3409
|
+
${o.settings} ${this.t("manageAccount")}
|
|
3410
3410
|
</button>
|
|
3411
3411
|
<button class="btn btn-ghost btn-block" @click=${this.onSignOut} ?disabled=${this.busy}>
|
|
3412
|
-
${
|
|
3412
|
+
${o.logOut} ${this.t("signOut")}
|
|
3413
3413
|
</button>
|
|
3414
3414
|
</div>
|
|
3415
3415
|
</div>
|
|
@@ -3509,9 +3509,9 @@ let $ = class extends U {
|
|
|
3509
3509
|
}
|
|
3510
3510
|
renderSignIn() {
|
|
3511
3511
|
const e = this.config?.methods ?? {}, t = e.emailPassword !== !1, i = (e.oauth?.length ?? 0) > 0, s = [
|
|
3512
|
-
e.magicUrl ? { step: "magic-url", icon:
|
|
3513
|
-
e.emailOtp ? { step: "email-otp", icon:
|
|
3514
|
-
e.phone ? { step: "phone", icon:
|
|
3512
|
+
e.magicUrl ? { step: "magic-url", icon: o.link, label: this.t("sendMagicLink") } : null,
|
|
3513
|
+
e.emailOtp ? { step: "email-otp", icon: o.mail, label: this.t("continueWithEmail") } : null,
|
|
3514
|
+
e.phone ? { step: "phone", icon: o.smartphone, label: this.t("continueWithPhone") } : null
|
|
3515
3515
|
].filter(Boolean);
|
|
3516
3516
|
return r`
|
|
3517
3517
|
<div class="stack">
|
|
@@ -3549,7 +3549,7 @@ let $ = class extends U {
|
|
|
3549
3549
|
@click=${this.onGuest}
|
|
3550
3550
|
?disabled=${this.busy}
|
|
3551
3551
|
>
|
|
3552
|
-
${
|
|
3552
|
+
${o.ghost} ${this.t("continueAsGuest")}
|
|
3553
3553
|
${z() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3554
3554
|
</button>` : n}
|
|
3555
3555
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
@@ -3622,13 +3622,13 @@ let $ = class extends U {
|
|
|
3622
3622
|
this.step = "sign-in", this.error = "", this.notice = null, this.focusOnStep = !0, this.fire("authui-view", { view: "sign-in" });
|
|
3623
3623
|
}}
|
|
3624
3624
|
>
|
|
3625
|
-
${
|
|
3625
|
+
${o.arrowLeft} ${this.t("back")}
|
|
3626
3626
|
</button>
|
|
3627
3627
|
</div>
|
|
3628
3628
|
</div>
|
|
3629
3629
|
` : r`<div class="stack">
|
|
3630
3630
|
<div class="alert alert-error" role="alert">
|
|
3631
|
-
${
|
|
3631
|
+
${o.alert}
|
|
3632
3632
|
<div class="alert-body">${this.t("errorInvalidToken")}</div>
|
|
3633
3633
|
</div>
|
|
3634
3634
|
<div class="links">
|
|
@@ -3646,7 +3646,7 @@ let $ = class extends U {
|
|
|
3646
3646
|
}
|
|
3647
3647
|
phraseBox(e) {
|
|
3648
3648
|
return e ? r`<div class="alert alert-info">
|
|
3649
|
-
${
|
|
3649
|
+
${o.shield}
|
|
3650
3650
|
<div class="alert-title">
|
|
3651
3651
|
${this.t("securityPhrase")}: <span class="code">${e}</span>
|
|
3652
3652
|
</div>
|
|
@@ -3656,7 +3656,7 @@ let $ = class extends U {
|
|
|
3656
3656
|
renderMagicUrl() {
|
|
3657
3657
|
return this.token ? r`<div class="stack">
|
|
3658
3658
|
<div class="alert alert-success" role="status">
|
|
3659
|
-
${
|
|
3659
|
+
${o.mail}
|
|
3660
3660
|
<div class="alert-body">${this.t("magicLinkSent", { email: this.token.target })}</div>
|
|
3661
3661
|
</div>
|
|
3662
3662
|
${this.phraseBox(this.token.phrase)} ${this.backLink()}
|
|
@@ -3673,10 +3673,10 @@ let $ = class extends U {
|
|
|
3673
3673
|
const e = this.token;
|
|
3674
3674
|
!e || Date.now() < this.resendCooldownUntil || (this.error = "", await this.run(async () => {
|
|
3675
3675
|
if (e.kind === "phone") {
|
|
3676
|
-
const t = await
|
|
3676
|
+
const t = await l.sendPhoneOtp(e.target);
|
|
3677
3677
|
this.token = { userId: t.userId, kind: "phone", target: e.target };
|
|
3678
3678
|
} else {
|
|
3679
|
-
const t = await
|
|
3679
|
+
const t = await l.sendEmailOtp(e.target);
|
|
3680
3680
|
this.token = {
|
|
3681
3681
|
userId: t.userId,
|
|
3682
3682
|
kind: "email-otp",
|
|
@@ -3691,7 +3691,7 @@ let $ = class extends U {
|
|
|
3691
3691
|
const e = this.token?.kind === "phone", t = Date.now() < this.resendCooldownUntil;
|
|
3692
3692
|
return r`
|
|
3693
3693
|
<div class="alert alert-info" role="status">
|
|
3694
|
-
${e ?
|
|
3694
|
+
${e ? o.smartphone : o.mail}
|
|
3695
3695
|
<div class="alert-body">${this.t("codeSent", { target: this.token.target })}</div>
|
|
3696
3696
|
</div>
|
|
3697
3697
|
${this.phraseBox(this.token.phrase)}
|
|
@@ -3761,25 +3761,25 @@ let $ = class extends U {
|
|
|
3761
3761
|
const i = [
|
|
3762
3762
|
{
|
|
3763
3763
|
factor: "totp",
|
|
3764
|
-
icon:
|
|
3764
|
+
icon: o.smartphone,
|
|
3765
3765
|
label: this.t("mfaUseAuthenticator"),
|
|
3766
3766
|
available: e?.totp ?? !0
|
|
3767
3767
|
},
|
|
3768
3768
|
{
|
|
3769
3769
|
factor: "email",
|
|
3770
|
-
icon:
|
|
3770
|
+
icon: o.mail,
|
|
3771
3771
|
label: this.t("mfaUseEmail"),
|
|
3772
3772
|
available: e?.email ?? !0
|
|
3773
3773
|
},
|
|
3774
3774
|
{
|
|
3775
3775
|
factor: "phone",
|
|
3776
|
-
icon:
|
|
3776
|
+
icon: o.phone,
|
|
3777
3777
|
label: this.t("mfaUsePhone"),
|
|
3778
3778
|
available: e?.phone ?? !0
|
|
3779
3779
|
},
|
|
3780
3780
|
{
|
|
3781
3781
|
factor: "recoverycode",
|
|
3782
|
-
icon:
|
|
3782
|
+
icon: o.key,
|
|
3783
3783
|
label: this.t("mfaUseRecoveryCode"),
|
|
3784
3784
|
available: e?.recoveryCode ?? !0
|
|
3785
3785
|
}
|
|
@@ -3827,7 +3827,7 @@ let $ = class extends U {
|
|
|
3827
3827
|
</form>
|
|
3828
3828
|
<div class="links">
|
|
3829
3829
|
<button type="button" class="btn btn-link" @click=${() => this.challenge = null}>
|
|
3830
|
-
${
|
|
3830
|
+
${o.arrowLeft} ${this.t("back")}
|
|
3831
3831
|
</button>
|
|
3832
3832
|
<span aria-hidden="true">·</span>
|
|
3833
3833
|
<button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
|
|
@@ -3838,7 +3838,7 @@ let $ = class extends U {
|
|
|
3838
3838
|
`;
|
|
3839
3839
|
}
|
|
3840
3840
|
};
|
|
3841
|
-
$.styles = [...
|
|
3841
|
+
$.styles = [...E.styles, Kt];
|
|
3842
3842
|
k([
|
|
3843
3843
|
m({ type: String })
|
|
3844
3844
|
], $.prototype, "view", 2);
|
|
@@ -3894,16 +3894,16 @@ k([
|
|
|
3894
3894
|
c()
|
|
3895
3895
|
], $.prototype, "legalErrorFromOAuth", 2);
|
|
3896
3896
|
$ = k([
|
|
3897
|
-
|
|
3897
|
+
L("authui-sign-in")
|
|
3898
3898
|
], $);
|
|
3899
3899
|
var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, f = (e, t, i, s) => {
|
|
3900
3900
|
for (var a = s > 1 ? void 0 : s ? Qt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
3901
3901
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3902
3902
|
return s && a && Xt(t, i, a), a;
|
|
3903
3903
|
};
|
|
3904
|
-
let p = class extends
|
|
3904
|
+
let p = class extends E {
|
|
3905
3905
|
constructor() {
|
|
3906
|
-
super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
3906
|
+
super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.showOldPassword = !1, this.showNewPassword = !1, this.showNewPasswordConfirm = !1, this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.verifyPhoneCooldownUntil = 0, this.verifyPhoneCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
3907
3907
|
const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
|
|
3908
3908
|
if (!t.length) return;
|
|
3909
3909
|
const i = t.findIndex((h) => h.getAttribute("aria-selected") === "true");
|
|
@@ -3918,12 +3918,12 @@ let p = class extends U {
|
|
|
3918
3918
|
const a = t[s].id.replace("authui-tab-", "");
|
|
3919
3919
|
this.select(a), requestAnimationFrame(() => t[s]?.focus());
|
|
3920
3920
|
}, this.noticeTimer = null, this.factorsLoading = !1, this.onUpdateName = (e) => {
|
|
3921
|
-
e.preventDefault(), this.requireValid(e) && this.run("name", () =>
|
|
3921
|
+
e.preventDefault(), this.requireValid(e) && this.run("name", () => l.updateName(this.nameInput), this.t("nameUpdated"));
|
|
3922
3922
|
}, this.onUpdateEmail = (e) => {
|
|
3923
3923
|
e.preventDefault(), this.requireValid(e) && this.run(
|
|
3924
3924
|
"email",
|
|
3925
3925
|
async () => {
|
|
3926
|
-
await
|
|
3926
|
+
await l.updateEmail(this.emailInput, this.emailPassword), this.emailPassword = "";
|
|
3927
3927
|
},
|
|
3928
3928
|
this.t("emailUpdated")
|
|
3929
3929
|
);
|
|
@@ -3931,7 +3931,7 @@ let p = class extends U {
|
|
|
3931
3931
|
e.preventDefault(), this.requireValid(e) && this.run(
|
|
3932
3932
|
"phone",
|
|
3933
3933
|
async () => {
|
|
3934
|
-
await
|
|
3934
|
+
await l.updatePhone(this.phoneInput, this.phonePassword), this.phonePassword = "";
|
|
3935
3935
|
},
|
|
3936
3936
|
this.t("phoneUpdated")
|
|
3937
3937
|
);
|
|
@@ -3939,7 +3939,7 @@ let p = class extends U {
|
|
|
3939
3939
|
e.preventDefault(), this.requireValid(e) && this.run(
|
|
3940
3940
|
"guest",
|
|
3941
3941
|
async () => {
|
|
3942
|
-
await
|
|
3942
|
+
await l.convertGuest(this.emailInput, this.emailPassword, this.guestName), this.emailPassword = "";
|
|
3943
3943
|
},
|
|
3944
3944
|
this.t("accountConverted")
|
|
3945
3945
|
);
|
|
@@ -3947,19 +3947,19 @@ let p = class extends U {
|
|
|
3947
3947
|
Date.now() < this.verifyEmailCooldownUntil || this.run(
|
|
3948
3948
|
"verify",
|
|
3949
3949
|
async () => {
|
|
3950
|
-
await
|
|
3950
|
+
await l.sendEmailVerification(), this.startVerifyEmailCooldown();
|
|
3951
3951
|
},
|
|
3952
3952
|
this.t("verificationSent")
|
|
3953
3953
|
);
|
|
3954
3954
|
}, this.onSendPhoneVerification = () => {
|
|
3955
|
-
this.run("verify-phone", async () => {
|
|
3956
|
-
await
|
|
3955
|
+
Date.now() < this.verifyPhoneCooldownUntil || this.run("verify-phone", async () => {
|
|
3956
|
+
await l.sendPhoneVerification(), this.phoneCodeSent = !0, this.startVerifyPhoneCooldown();
|
|
3957
3957
|
});
|
|
3958
3958
|
}, this.onConfirmPhoneVerification = (e) => {
|
|
3959
3959
|
e.preventDefault(), this.requireValid(e) && this.run(
|
|
3960
3960
|
"verify-phone-code",
|
|
3961
3961
|
async () => {
|
|
3962
|
-
await
|
|
3962
|
+
await l.confirmPhoneVerification(this.phoneCode), this.phoneCode = "", this.phoneCodeSent = !1, this.verifyPhoneCooldownUntil = 0, this.clearVerifyPhoneCooldownTimer();
|
|
3963
3963
|
},
|
|
3964
3964
|
this.t("phoneVerified")
|
|
3965
3965
|
);
|
|
@@ -3972,7 +3972,7 @@ let p = class extends U {
|
|
|
3972
3972
|
this.run(
|
|
3973
3973
|
"password",
|
|
3974
3974
|
async () => {
|
|
3975
|
-
await
|
|
3975
|
+
await l.updatePassword(this.newPassword, this.oldPassword), this.oldPassword = this.newPassword = this.newPasswordConfirm = "";
|
|
3976
3976
|
},
|
|
3977
3977
|
this.t("passwordChanged")
|
|
3978
3978
|
);
|
|
@@ -3980,17 +3980,17 @@ let p = class extends U {
|
|
|
3980
3980
|
}, this.onToggleMfa = () => {
|
|
3981
3981
|
const e = !this.user?.mfa;
|
|
3982
3982
|
this.run("mfa", async () => {
|
|
3983
|
-
await
|
|
3983
|
+
await l.setMfaEnabled(e), await this.loadFactors();
|
|
3984
3984
|
});
|
|
3985
3985
|
}, this.onAddAuthenticator = () => {
|
|
3986
3986
|
this.run("authenticator", async () => {
|
|
3987
|
-
this.authenticator = await
|
|
3987
|
+
this.authenticator = await l.addAuthenticator(), this.authenticatorCode = "";
|
|
3988
3988
|
});
|
|
3989
3989
|
}, this.onVerifyAuthenticator = (e) => {
|
|
3990
3990
|
e.preventDefault(), this.requireValid(e) && this.run(
|
|
3991
3991
|
"authenticator-code",
|
|
3992
3992
|
async () => {
|
|
3993
|
-
await
|
|
3993
|
+
await l.verifyAuthenticator(this.authenticatorCode), this.authenticator = null, this.authenticatorCode = "", await this.loadFactors();
|
|
3994
3994
|
},
|
|
3995
3995
|
this.t("authenticatorAdded")
|
|
3996
3996
|
);
|
|
@@ -4000,15 +4000,15 @@ let p = class extends U {
|
|
|
4000
4000
|
return;
|
|
4001
4001
|
}
|
|
4002
4002
|
this.confirmRemoveAuthenticator = !1, this.run("remove-authenticator", async () => {
|
|
4003
|
-
await
|
|
4003
|
+
await l.removeAuthenticator(), await this.loadFactors();
|
|
4004
4004
|
});
|
|
4005
4005
|
}, this.onRecoveryCodes = () => {
|
|
4006
4006
|
this.run("recovery", async () => {
|
|
4007
4007
|
try {
|
|
4008
|
-
this.recoveryCodes = await
|
|
4008
|
+
this.recoveryCodes = await l.createRecoveryCodes();
|
|
4009
4009
|
} catch (e) {
|
|
4010
4010
|
if (!j(e, v.recoveryCodesExist)) throw e;
|
|
4011
|
-
this.recoveryCodes = await
|
|
4011
|
+
this.recoveryCodes = await l.getRecoveryCodes();
|
|
4012
4012
|
}
|
|
4013
4013
|
await this.loadFactors();
|
|
4014
4014
|
});
|
|
@@ -4018,7 +4018,7 @@ let p = class extends U {
|
|
|
4018
4018
|
return;
|
|
4019
4019
|
}
|
|
4020
4020
|
this.confirmRegenerate = !1, this.run("recovery", async () => {
|
|
4021
|
-
this.recoveryCodes = await
|
|
4021
|
+
this.recoveryCodes = await l.regenerateRecoveryCodes();
|
|
4022
4022
|
});
|
|
4023
4023
|
}, this.onCopyCodes = async () => {
|
|
4024
4024
|
if (this.recoveryCodes)
|
|
@@ -4038,7 +4038,7 @@ let p = class extends U {
|
|
|
4038
4038
|
}
|
|
4039
4039
|
}, this.onStepUpFactor = (e) => {
|
|
4040
4040
|
this.run("stepup", async () => {
|
|
4041
|
-
const t = await
|
|
4041
|
+
const t = await l.createMfaChallenge(e);
|
|
4042
4042
|
this.stepUp = { ...this.stepUp, challenge: { id: t.$id, factor: e } }, this.stepUpCode = "";
|
|
4043
4043
|
});
|
|
4044
4044
|
}, this.onStepUpVerify = (e) => {
|
|
@@ -4047,40 +4047,40 @@ let p = class extends U {
|
|
|
4047
4047
|
t?.challenge && (async () => {
|
|
4048
4048
|
let i = !1;
|
|
4049
4049
|
await this.run("stepup-code", async () => {
|
|
4050
|
-
await
|
|
4050
|
+
await l.completeMfaChallenge(t.challenge.id, this.stepUpCode, { signIn: !1 }), this.stepUp = null, this.stepUpCode = "", i = !0;
|
|
4051
4051
|
}), i && await t.retry();
|
|
4052
4052
|
})();
|
|
4053
4053
|
}, this.onDeleteSession = (e) => {
|
|
4054
4054
|
this.run(`session-${e}`, async () => {
|
|
4055
4055
|
if ((this.sessions ?? []).some((i) => i.$id === e && i.current)) {
|
|
4056
|
-
await
|
|
4056
|
+
await l.signOut(), this.sessions = [];
|
|
4057
4057
|
return;
|
|
4058
4058
|
}
|
|
4059
|
-
await
|
|
4059
|
+
await l.signOut(e), this.sessions = (this.sessions ?? []).filter((i) => i.$id !== e);
|
|
4060
4060
|
});
|
|
4061
4061
|
}, this.onSignOutAll = () => {
|
|
4062
4062
|
if (!this.confirmSignOutAll) {
|
|
4063
4063
|
this.confirmSignOutAll = !0;
|
|
4064
4064
|
return;
|
|
4065
4065
|
}
|
|
4066
|
-
this.confirmSignOutAll = !1, this.run("sessions-all", () =>
|
|
4066
|
+
this.confirmSignOutAll = !1, this.run("sessions-all", () => l.signOutEverywhere());
|
|
4067
4067
|
}, this.onDeleteIdentity = (e) => {
|
|
4068
4068
|
if (this.confirmDisconnectId !== e) {
|
|
4069
4069
|
this.confirmDisconnectId = e;
|
|
4070
4070
|
return;
|
|
4071
4071
|
}
|
|
4072
4072
|
this.confirmDisconnectId = null, this.run(`identity-${e}`, async () => {
|
|
4073
|
-
await
|
|
4073
|
+
await l.deleteIdentity(e), this.identities = (this.identities ?? []).filter((t) => t.$id !== e);
|
|
4074
4074
|
});
|
|
4075
4075
|
}, this.onDeleteAccount = () => {
|
|
4076
|
-
this.run("delete", () =>
|
|
4076
|
+
this.run("delete", () => l.deleteAccount());
|
|
4077
4077
|
};
|
|
4078
4078
|
}
|
|
4079
4079
|
connectedCallback() {
|
|
4080
4080
|
super.connectedCallback(), this.active = this.tab, this.hydrate();
|
|
4081
4081
|
}
|
|
4082
4082
|
disconnectedCallback() {
|
|
4083
|
-
super.disconnectedCallback(), this.clearVerifyEmailCooldownTimer(), this.noticeTimer && (clearTimeout(this.noticeTimer), this.noticeTimer = null);
|
|
4083
|
+
super.disconnectedCallback(), this.clearVerifyEmailCooldownTimer(), this.clearVerifyPhoneCooldownTimer(), this.noticeTimer && (clearTimeout(this.noticeTimer), this.noticeTimer = null);
|
|
4084
4084
|
}
|
|
4085
4085
|
willUpdate(e) {
|
|
4086
4086
|
e.has("tab") && e.get("tab") !== void 0 && (this.active = this.tab), e.has("auth") && this.hydrate(), this.ensureLoaded();
|
|
@@ -4109,7 +4109,7 @@ let p = class extends U {
|
|
|
4109
4109
|
'.tab[aria-selected="true"]'
|
|
4110
4110
|
);
|
|
4111
4111
|
i && typeof i.scrollIntoView == "function" && i.scrollIntoView({ inline: "nearest", block: "nearest", behavior: "smooth" });
|
|
4112
|
-
}), (e.has("confirmDelete") && this.confirmDelete || e.has("confirmSignOutAll") && this.confirmSignOutAll || e.has("confirmDisconnectId") && this.confirmDisconnectId !== null) && requestAnimationFrame(() => {
|
|
4112
|
+
}), (e.has("confirmDelete") && this.confirmDelete || e.has("confirmSignOutAll") && this.confirmSignOutAll || e.has("confirmDisconnectId") && this.confirmDisconnectId !== null || e.has("confirmRegenerate") && this.confirmRegenerate || e.has("confirmRemoveAuthenticator") && this.confirmRemoveAuthenticator) && requestAnimationFrame(() => {
|
|
4113
4113
|
this.renderRoot.querySelector(
|
|
4114
4114
|
".card-footer [autofocus], .row-actions [autofocus], .inline [autofocus], .card-footer .btn-outline, .row-actions .btn-outline, .inline .btn-outline"
|
|
4115
4115
|
)?.focus({ preventScroll: !0 });
|
|
@@ -4146,12 +4146,12 @@ let p = class extends U {
|
|
|
4146
4146
|
// ─────────────────────────── loaders ───────────────────────────
|
|
4147
4147
|
async loadSessions() {
|
|
4148
4148
|
await this.run("sessions", async () => {
|
|
4149
|
-
this.sessions = await
|
|
4149
|
+
this.sessions = await l.listSessions();
|
|
4150
4150
|
});
|
|
4151
4151
|
}
|
|
4152
4152
|
async loadIdentities() {
|
|
4153
4153
|
await this.run("identities", async () => {
|
|
4154
|
-
this.identities = await
|
|
4154
|
+
this.identities = await l.listIdentities();
|
|
4155
4155
|
});
|
|
4156
4156
|
}
|
|
4157
4157
|
/** Probe once so Activity is never shown on servers without /account/logs. */
|
|
@@ -4159,7 +4159,7 @@ let p = class extends U {
|
|
|
4159
4159
|
if (!this.logsProbeStarted) {
|
|
4160
4160
|
this.logsProbeStarted = !0;
|
|
4161
4161
|
try {
|
|
4162
|
-
this.logs = await
|
|
4162
|
+
this.logs = await l.listLogs(), this.logsSupported = !0;
|
|
4163
4163
|
} catch {
|
|
4164
4164
|
this.logsSupported = !1, this.logs = [], this.active === "activity" && (this.active = "profile");
|
|
4165
4165
|
}
|
|
@@ -4172,7 +4172,7 @@ let p = class extends U {
|
|
|
4172
4172
|
}
|
|
4173
4173
|
this.busy = "logs";
|
|
4174
4174
|
try {
|
|
4175
|
-
this.logs = await
|
|
4175
|
+
this.logs = await l.listLogs();
|
|
4176
4176
|
} catch {
|
|
4177
4177
|
this.logsSupported = !1, this.logs = [], this.active === "activity" && (this.active = "profile");
|
|
4178
4178
|
} finally {
|
|
@@ -4183,7 +4183,7 @@ let p = class extends U {
|
|
|
4183
4183
|
if (!this.factorsLoading) {
|
|
4184
4184
|
this.factorsLoading = !0;
|
|
4185
4185
|
try {
|
|
4186
|
-
this.factors = await
|
|
4186
|
+
this.factors = await l.listMfaFactors();
|
|
4187
4187
|
} catch {
|
|
4188
4188
|
this.factors = {
|
|
4189
4189
|
totp: !1,
|
|
@@ -4205,6 +4205,14 @@ let p = class extends U {
|
|
|
4205
4205
|
clearVerifyEmailCooldownTimer() {
|
|
4206
4206
|
this.verifyEmailCooldownTimer && (clearInterval(this.verifyEmailCooldownTimer), this.verifyEmailCooldownTimer = null);
|
|
4207
4207
|
}
|
|
4208
|
+
startVerifyPhoneCooldown() {
|
|
4209
|
+
this.verifyPhoneCooldownUntil = Date.now() + 45e3, this.clearVerifyPhoneCooldownTimer(), this.verifyPhoneCooldownTimer = setInterval(() => {
|
|
4210
|
+
this.requestUpdate(), Date.now() >= this.verifyPhoneCooldownUntil && this.clearVerifyPhoneCooldownTimer();
|
|
4211
|
+
}, 1e3);
|
|
4212
|
+
}
|
|
4213
|
+
clearVerifyPhoneCooldownTimer() {
|
|
4214
|
+
this.verifyPhoneCooldownTimer && (clearInterval(this.verifyPhoneCooldownTimer), this.verifyPhoneCooldownTimer = null);
|
|
4215
|
+
}
|
|
4208
4216
|
bind(e) {
|
|
4209
4217
|
return (t) => {
|
|
4210
4218
|
this[e] = t.target.value;
|
|
@@ -4214,7 +4222,7 @@ let p = class extends U {
|
|
|
4214
4222
|
render() {
|
|
4215
4223
|
if (!this.auth.configured)
|
|
4216
4224
|
return r`<div class="alert alert-error" role="alert">
|
|
4217
|
-
${
|
|
4225
|
+
${o.alert}
|
|
4218
4226
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
4219
4227
|
</div>`;
|
|
4220
4228
|
if (this.auth.status === "loading")
|
|
@@ -4251,7 +4259,7 @@ let p = class extends U {
|
|
|
4251
4259
|
)}
|
|
4252
4260
|
</div>
|
|
4253
4261
|
${this.notice ? r`<div class="alert alert-${this.notice.tone}" role="status">
|
|
4254
|
-
${this.notice.tone === "success" ?
|
|
4262
|
+
${this.notice.tone === "success" ? o.checkCircle : o.info}
|
|
4255
4263
|
<div class="alert-body">${this.notice.message}</div>
|
|
4256
4264
|
<button
|
|
4257
4265
|
class="btn btn-ghost btn-icon dismiss"
|
|
@@ -4260,7 +4268,7 @@ let p = class extends U {
|
|
|
4260
4268
|
}}
|
|
4261
4269
|
aria-label=${this.t("close")}
|
|
4262
4270
|
>
|
|
4263
|
-
${
|
|
4271
|
+
${o.x}
|
|
4264
4272
|
</button>
|
|
4265
4273
|
</div>` : n}
|
|
4266
4274
|
${this.stepUp ? this.renderStepUp() : r`<div
|
|
@@ -4283,14 +4291,14 @@ let p = class extends U {
|
|
|
4283
4291
|
<div class="row-main">
|
|
4284
4292
|
<span class="row-title" title=${t}>
|
|
4285
4293
|
${t}
|
|
4286
|
-
${e.mfa ? r`<span class="badge badge-success">${
|
|
4287
|
-
${
|
|
4294
|
+
${e.mfa ? r`<span class="badge badge-success">${o.shieldCheck} ${this.t("mfaBadge")}</span>` : n}
|
|
4295
|
+
${l.isPreview ? r`<span class="badge badge-info">${this.t("preview")}</span>` : n}
|
|
4288
4296
|
</span>
|
|
4289
4297
|
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
|
|
4290
4298
|
</div>
|
|
4291
4299
|
</div>
|
|
4292
|
-
<button class="btn btn-outline btn-sm" @click=${() =>
|
|
4293
|
-
${
|
|
4300
|
+
<button class="btn btn-outline btn-sm" @click=${() => l.signOut()}>
|
|
4301
|
+
${o.logOut} ${this.t("signOut")}
|
|
4294
4302
|
</button>
|
|
4295
4303
|
</div>
|
|
4296
4304
|
`;
|
|
@@ -4312,7 +4320,7 @@ let p = class extends U {
|
|
|
4312
4320
|
error(e) {
|
|
4313
4321
|
const t = this.errors[e];
|
|
4314
4322
|
return t ? r`<div class="alert alert-error" role="alert">
|
|
4315
|
-
${
|
|
4323
|
+
${o.alert}
|
|
4316
4324
|
<div class="alert-body">${t}</div>
|
|
4317
4325
|
</div>` : n;
|
|
4318
4326
|
}
|
|
@@ -4359,7 +4367,7 @@ let p = class extends U {
|
|
|
4359
4367
|
</div>`;
|
|
4360
4368
|
}
|
|
4361
4369
|
verifiedBadge(e) {
|
|
4362
|
-
return e ? r`<span class="badge badge-success">${
|
|
4370
|
+
return e ? r`<span class="badge badge-success">${o.check} ${this.t("verified")}</span>` : r`<span class="badge badge-warning">${this.t("unverified")}</span>`;
|
|
4363
4371
|
}
|
|
4364
4372
|
// ── Profile ──
|
|
4365
4373
|
renderProfile() {
|
|
@@ -4584,13 +4592,27 @@ let p = class extends U {
|
|
|
4584
4592
|
${this.spinner("verify-phone")} ${this.t("sendCode")}
|
|
4585
4593
|
</button>` : n}
|
|
4586
4594
|
${this.phoneCodeSent ? r`<button
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4595
|
+
class="btn btn-outline btn-sm"
|
|
4596
|
+
type="button"
|
|
4597
|
+
@click=${this.onSendPhoneVerification}
|
|
4598
|
+
?disabled=${!!this.busy || Date.now() < this.verifyPhoneCooldownUntil}
|
|
4599
|
+
>
|
|
4600
|
+
${this.spinner("verify-phone")}
|
|
4601
|
+
${Date.now() < this.verifyPhoneCooldownUntil ? this.t("verificationResendIn", {
|
|
4602
|
+
seconds: Math.max(
|
|
4603
|
+
1,
|
|
4604
|
+
Math.ceil((this.verifyPhoneCooldownUntil - Date.now()) / 1e3)
|
|
4605
|
+
)
|
|
4606
|
+
}) : this.t("resendCode")}
|
|
4607
|
+
</button>
|
|
4608
|
+
<button
|
|
4609
|
+
class="btn btn-outline btn-sm"
|
|
4610
|
+
type="button"
|
|
4611
|
+
@click=${this.onConfirmPhoneVerification}
|
|
4612
|
+
?disabled=${!!this.busy}
|
|
4613
|
+
>
|
|
4614
|
+
${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
|
|
4615
|
+
</button>` : n}
|
|
4594
4616
|
<button
|
|
4595
4617
|
class="btn btn-primary btn-sm"
|
|
4596
4618
|
type="submit"
|
|
@@ -4610,7 +4632,7 @@ let p = class extends U {
|
|
|
4610
4632
|
this.t("deleteAccountDescription"),
|
|
4611
4633
|
this.confirmDelete ? this.error("delete") : r`${this.error("delete")}
|
|
4612
4634
|
<button class="btn btn-outline btn-sm warn" @click=${() => this.confirmDelete = !0}>
|
|
4613
|
-
${
|
|
4635
|
+
${o.userX} ${this.t("deleteAccount")}
|
|
4614
4636
|
</button>`,
|
|
4615
4637
|
this.confirmDelete ? this.confirmFooter(
|
|
4616
4638
|
() => {
|
|
@@ -4642,28 +4664,48 @@ let p = class extends U {
|
|
|
4642
4664
|
<label class="label" for="acc-old-password"
|
|
4643
4665
|
>${this.t("currentPassword")}</label
|
|
4644
4666
|
>
|
|
4645
|
-
<input
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4667
|
+
<div class="input-wrap">
|
|
4668
|
+
<input
|
|
4669
|
+
class="input"
|
|
4670
|
+
id="acc-old-password"
|
|
4671
|
+
type=${this.showOldPassword ? "text" : "password"}
|
|
4672
|
+
.value=${this.oldPassword}
|
|
4673
|
+
@input=${this.bind("oldPassword")}
|
|
4674
|
+
autocomplete="current-password"
|
|
4675
|
+
required
|
|
4676
|
+
/>
|
|
4677
|
+
<button
|
|
4678
|
+
type="button"
|
|
4679
|
+
class="btn btn-ghost btn-icon"
|
|
4680
|
+
@click=${() => this.showOldPassword = !this.showOldPassword}
|
|
4681
|
+
aria-label=${this.showOldPassword ? this.t("hidePassword") : this.t("showPassword")}
|
|
4682
|
+
>
|
|
4683
|
+
${this.showOldPassword ? o.eyeOff : o.eye}
|
|
4684
|
+
</button>
|
|
4685
|
+
</div>
|
|
4654
4686
|
</div>` : n}
|
|
4655
4687
|
<div class="field">
|
|
4656
4688
|
<label class="label" for="acc-new-password">${this.t("newPassword")}</label>
|
|
4657
|
-
<input
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4689
|
+
<div class="input-wrap">
|
|
4690
|
+
<input
|
|
4691
|
+
class="input"
|
|
4692
|
+
id="acc-new-password"
|
|
4693
|
+
type=${this.showNewPassword ? "text" : "password"}
|
|
4694
|
+
required
|
|
4695
|
+
minlength="8"
|
|
4696
|
+
.value=${this.newPassword}
|
|
4697
|
+
@input=${this.bind("newPassword")}
|
|
4698
|
+
autocomplete="new-password"
|
|
4699
|
+
/>
|
|
4700
|
+
<button
|
|
4701
|
+
type="button"
|
|
4702
|
+
class="btn btn-ghost btn-icon"
|
|
4703
|
+
@click=${() => this.showNewPassword = !this.showNewPassword}
|
|
4704
|
+
aria-label=${this.showNewPassword ? this.t("hidePassword") : this.t("showPassword")}
|
|
4705
|
+
>
|
|
4706
|
+
${this.showNewPassword ? o.eyeOff : o.eye}
|
|
4707
|
+
</button>
|
|
4708
|
+
</div>
|
|
4667
4709
|
${this.newPassword ? (() => {
|
|
4668
4710
|
const i = rt(this.newPassword);
|
|
4669
4711
|
return r`<div class="strength" aria-live="polite">
|
|
@@ -4687,16 +4729,26 @@ let p = class extends U {
|
|
|
4687
4729
|
<label class="label" for="acc-new-password-confirm"
|
|
4688
4730
|
>${this.t("confirmPassword")}</label
|
|
4689
4731
|
>
|
|
4690
|
-
<input
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4732
|
+
<div class="input-wrap">
|
|
4733
|
+
<input
|
|
4734
|
+
class="input"
|
|
4735
|
+
id="acc-new-password-confirm"
|
|
4736
|
+
type=${this.showNewPasswordConfirm ? "text" : "password"}
|
|
4737
|
+
required
|
|
4738
|
+
minlength="8"
|
|
4739
|
+
.value=${this.newPasswordConfirm}
|
|
4740
|
+
@input=${this.bind("newPasswordConfirm")}
|
|
4741
|
+
autocomplete="new-password"
|
|
4742
|
+
/>
|
|
4743
|
+
<button
|
|
4744
|
+
type="button"
|
|
4745
|
+
class="btn btn-ghost btn-icon"
|
|
4746
|
+
@click=${() => this.showNewPasswordConfirm = !this.showNewPasswordConfirm}
|
|
4747
|
+
aria-label=${this.showNewPasswordConfirm ? this.t("hidePassword") : this.t("showPassword")}
|
|
4748
|
+
>
|
|
4749
|
+
${this.showNewPasswordConfirm ? o.eyeOff : o.eye}
|
|
4750
|
+
</button>
|
|
4751
|
+
</div>
|
|
4700
4752
|
</div>
|
|
4701
4753
|
${this.error("password")}
|
|
4702
4754
|
</form>`,
|
|
@@ -4714,7 +4766,7 @@ let p = class extends U {
|
|
|
4714
4766
|
</div>`;
|
|
4715
4767
|
}
|
|
4716
4768
|
renderMfaCard() {
|
|
4717
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ?
|
|
4769
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ? Et(this.authenticator.uri) : new Ct(l.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4718
4770
|
return this.card(
|
|
4719
4771
|
this.t("twoFactor"),
|
|
4720
4772
|
this.t("twoFactorDescription"),
|
|
@@ -4734,7 +4786,7 @@ let p = class extends U {
|
|
|
4734
4786
|
></button>
|
|
4735
4787
|
</div>
|
|
4736
4788
|
${e.mfa && !(this.factors?.totp || e.emailVerification || e.phoneVerification) ? r`<div class="alert alert-warning" role="status">
|
|
4737
|
-
${
|
|
4789
|
+
${o.alert}
|
|
4738
4790
|
<div class="alert-body">
|
|
4739
4791
|
${this.t("mfaNoFactorWarning")}
|
|
4740
4792
|
${this.factors?.totp ? n : r`<div class="links">
|
|
@@ -4754,23 +4806,27 @@ let p = class extends U {
|
|
|
4754
4806
|
<div class="toggle-row">
|
|
4755
4807
|
<div class="row-main">
|
|
4756
4808
|
<span class="row-title"
|
|
4757
|
-
>${
|
|
4809
|
+
>${o.smartphone} ${this.t("authenticatorApp")}
|
|
4758
4810
|
${t ? this.verifiedBadge(!0) : n}</span
|
|
4759
4811
|
>
|
|
4760
4812
|
</div>
|
|
4761
4813
|
${t ? this.confirmRemoveAuthenticator ? r`<div class="inline">
|
|
4762
4814
|
<button
|
|
4763
|
-
|
|
4764
|
-
|
|
4815
|
+
type="button"
|
|
4816
|
+
class="btn btn-outline btn-sm"
|
|
4817
|
+
autofocus
|
|
4765
4818
|
?disabled=${!!this.busy}
|
|
4819
|
+
@click=${() => this.confirmRemoveAuthenticator = !1}
|
|
4766
4820
|
>
|
|
4767
|
-
${this.
|
|
4821
|
+
${this.t("cancel")}
|
|
4768
4822
|
</button>
|
|
4769
4823
|
<button
|
|
4770
|
-
|
|
4771
|
-
|
|
4824
|
+
type="button"
|
|
4825
|
+
class="btn btn-destructive btn-sm"
|
|
4826
|
+
@click=${this.onRemoveAuthenticator}
|
|
4827
|
+
?disabled=${!!this.busy}
|
|
4772
4828
|
>
|
|
4773
|
-
${this.t("
|
|
4829
|
+
${this.spinner("remove-authenticator")} ${this.t("remove")}
|
|
4774
4830
|
</button>
|
|
4775
4831
|
</div>` : r`<button
|
|
4776
4832
|
class="btn btn-outline btn-sm"
|
|
@@ -4802,7 +4858,7 @@ let p = class extends U {
|
|
|
4802
4858
|
this.onCopySecret();
|
|
4803
4859
|
}}
|
|
4804
4860
|
>
|
|
4805
|
-
${this.copied ?
|
|
4861
|
+
${this.copied ? o.check : o.copy}
|
|
4806
4862
|
${this.copied ? this.t("copied") : this.t("authenticatorCopyKey")}
|
|
4807
4863
|
</button>
|
|
4808
4864
|
</div>
|
|
@@ -4844,7 +4900,7 @@ let p = class extends U {
|
|
|
4844
4900
|
this.t("recoveryCodesDescription") + " " + this.t("recoveryCodesOnceHint"),
|
|
4845
4901
|
r`<div class="kv">
|
|
4846
4902
|
${this.recoveryCodes ? r`<div class="alert alert-warning">
|
|
4847
|
-
${
|
|
4903
|
+
${o.alert}
|
|
4848
4904
|
<div class="alert-body">${this.t("recoveryCodesWarning")}</div>
|
|
4849
4905
|
</div>
|
|
4850
4906
|
<div class="codes">
|
|
@@ -4852,7 +4908,7 @@ let p = class extends U {
|
|
|
4852
4908
|
</div>
|
|
4853
4909
|
<div class="inline">
|
|
4854
4910
|
<button class="btn btn-outline btn-sm" @click=${this.onCopyCodes}>
|
|
4855
|
-
${this.copied ?
|
|
4911
|
+
${this.copied ? o.check : o.copy}
|
|
4856
4912
|
${this.copied ? this.t("copied") : this.t("copy")}
|
|
4857
4913
|
</button>
|
|
4858
4914
|
<button class="btn btn-ghost btn-sm" @click=${() => this.recoveryCodes = null}>
|
|
@@ -4864,29 +4920,34 @@ let p = class extends U {
|
|
|
4864
4920
|
@click=${this.onRecoveryCodes}
|
|
4865
4921
|
?disabled=${!!this.busy}
|
|
4866
4922
|
>
|
|
4867
|
-
${this.spinner("recovery")} ${
|
|
4923
|
+
${this.spinner("recovery")} ${o.key}
|
|
4868
4924
|
${e ? this.t("viewRecoveryCodes") : this.t("generateRecoveryCodes")}
|
|
4869
4925
|
</button>
|
|
4870
4926
|
${e ? this.confirmRegenerate ? r`<div class="inline">
|
|
4871
4927
|
<button
|
|
4872
|
-
|
|
4873
|
-
|
|
4928
|
+
type="button"
|
|
4929
|
+
class="btn btn-outline btn-sm"
|
|
4930
|
+
autofocus
|
|
4874
4931
|
?disabled=${!!this.busy}
|
|
4932
|
+
@click=${() => this.confirmRegenerate = !1}
|
|
4875
4933
|
>
|
|
4876
|
-
${
|
|
4934
|
+
${this.t("cancel")}
|
|
4877
4935
|
</button>
|
|
4878
4936
|
<button
|
|
4879
|
-
|
|
4880
|
-
|
|
4937
|
+
type="button"
|
|
4938
|
+
class="btn btn-destructive btn-sm"
|
|
4939
|
+
@click=${this.onRegenerateRecoveryCodes}
|
|
4940
|
+
?disabled=${!!this.busy}
|
|
4881
4941
|
>
|
|
4882
|
-
${this.
|
|
4942
|
+
${this.spinner("recovery")} ${o.refresh}
|
|
4943
|
+
${this.t("regenerateRecoveryCodes")}
|
|
4883
4944
|
</button>
|
|
4884
4945
|
</div>` : r`<button
|
|
4885
4946
|
class="btn btn-ghost btn-sm"
|
|
4886
4947
|
@click=${this.onRegenerateRecoveryCodes}
|
|
4887
4948
|
?disabled=${!!this.busy}
|
|
4888
4949
|
>
|
|
4889
|
-
${
|
|
4950
|
+
${o.refresh} ${this.t("regenerateRecoveryCodes")}
|
|
4890
4951
|
</button>` : n}
|
|
4891
4952
|
</div>`}
|
|
4892
4953
|
${this.error("recovery")}
|
|
@@ -4898,25 +4959,25 @@ let p = class extends U {
|
|
|
4898
4959
|
const e = this.stepUp, t = this.factors, i = [
|
|
4899
4960
|
{
|
|
4900
4961
|
factor: "totp",
|
|
4901
|
-
icon:
|
|
4962
|
+
icon: o.smartphone,
|
|
4902
4963
|
label: this.t("mfaUseAuthenticator"),
|
|
4903
4964
|
available: t?.totp ?? !0
|
|
4904
4965
|
},
|
|
4905
4966
|
{
|
|
4906
4967
|
factor: "email",
|
|
4907
|
-
icon:
|
|
4968
|
+
icon: o.mail,
|
|
4908
4969
|
label: this.t("mfaUseEmail"),
|
|
4909
4970
|
available: t?.email ?? !0
|
|
4910
4971
|
},
|
|
4911
4972
|
{
|
|
4912
4973
|
factor: "phone",
|
|
4913
|
-
icon:
|
|
4974
|
+
icon: o.phone,
|
|
4914
4975
|
label: this.t("mfaUsePhone"),
|
|
4915
4976
|
available: t?.phone ?? !0
|
|
4916
4977
|
},
|
|
4917
4978
|
{
|
|
4918
4979
|
factor: "recoverycode",
|
|
4919
|
-
icon:
|
|
4980
|
+
icon: o.key,
|
|
4920
4981
|
label: this.t("mfaUseRecoveryCode"),
|
|
4921
4982
|
available: t?.recoveryCode ?? !0
|
|
4922
4983
|
}
|
|
@@ -4967,7 +5028,7 @@ let p = class extends U {
|
|
|
4967
5028
|
// ── Sessions ──
|
|
4968
5029
|
deviceIcon(e) {
|
|
4969
5030
|
const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
|
|
4970
|
-
return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ?
|
|
5031
|
+
return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ? o.smartphone : /desktop|browser/.test(t) || /mac|windows|linux|chrome os/.test(i) ? o.monitor : o.globe;
|
|
4971
5032
|
}
|
|
4972
5033
|
renderSessions() {
|
|
4973
5034
|
const e = this.sessions;
|
|
@@ -4977,7 +5038,7 @@ let p = class extends U {
|
|
|
4977
5038
|
void 0,
|
|
4978
5039
|
r`${this.error("sessions")}
|
|
4979
5040
|
${e === null ? r`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? this.emptyState(
|
|
4980
|
-
|
|
5041
|
+
o.monitor,
|
|
4981
5042
|
this.t("noSessions"),
|
|
4982
5043
|
this.t("noSessionsDescription")
|
|
4983
5044
|
) : e.map(
|
|
@@ -5003,7 +5064,7 @@ let p = class extends U {
|
|
|
5003
5064
|
?disabled=${!!this.busy}
|
|
5004
5065
|
aria-label=${this.t("signOutSession")}
|
|
5005
5066
|
>
|
|
5006
|
-
${
|
|
5067
|
+
${o.logOut}
|
|
5007
5068
|
</button>
|
|
5008
5069
|
</div>
|
|
5009
5070
|
</div>`
|
|
@@ -5018,7 +5079,7 @@ let p = class extends U {
|
|
|
5018
5079
|
@click=${this.onSignOutAll}
|
|
5019
5080
|
?disabled=${!!this.busy}
|
|
5020
5081
|
>
|
|
5021
|
-
${this.spinner("sessions-all")} ${
|
|
5082
|
+
${this.spinner("sessions-all")} ${o.logOut} ${this.t("signOutAllSessions")}
|
|
5022
5083
|
</button>`,
|
|
5023
5084
|
this.confirmSignOutAll ? this.confirmFooter(
|
|
5024
5085
|
() => {
|
|
@@ -5043,7 +5104,7 @@ let p = class extends U {
|
|
|
5043
5104
|
void 0,
|
|
5044
5105
|
r`${this.error("identities")}
|
|
5045
5106
|
${e === null ? r`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? this.emptyState(
|
|
5046
|
-
|
|
5107
|
+
o.link,
|
|
5047
5108
|
this.t("noConnections"),
|
|
5048
5109
|
this.t("noConnectionsDescription")
|
|
5049
5110
|
) : e.map(
|
|
@@ -5090,7 +5151,7 @@ let p = class extends U {
|
|
|
5090
5151
|
(i) => r`<button
|
|
5091
5152
|
class="btn btn-outline btn-sm"
|
|
5092
5153
|
@click=${() => {
|
|
5093
|
-
this.run(`connect-${i}`, () =>
|
|
5154
|
+
this.run(`connect-${i}`, () => l.signInWithOAuth(i));
|
|
5094
5155
|
}}
|
|
5095
5156
|
?disabled=${!!this.busy}
|
|
5096
5157
|
>
|
|
@@ -5109,7 +5170,7 @@ let p = class extends U {
|
|
|
5109
5170
|
this.t("activity"),
|
|
5110
5171
|
void 0,
|
|
5111
5172
|
r`${e === null ? r`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? this.emptyState(
|
|
5112
|
-
|
|
5173
|
+
o.activity,
|
|
5113
5174
|
this.t("noActivity"),
|
|
5114
5175
|
this.t("noActivityDescription")
|
|
5115
5176
|
) : e.map(
|
|
@@ -5128,8 +5189,8 @@ let p = class extends U {
|
|
|
5128
5189
|
}
|
|
5129
5190
|
};
|
|
5130
5191
|
p.styles = [
|
|
5131
|
-
...
|
|
5132
|
-
|
|
5192
|
+
...E.styles,
|
|
5193
|
+
T`
|
|
5133
5194
|
:host {
|
|
5134
5195
|
display: block;
|
|
5135
5196
|
width: 100%;
|
|
@@ -5276,6 +5337,15 @@ f([
|
|
|
5276
5337
|
f([
|
|
5277
5338
|
c()
|
|
5278
5339
|
], p.prototype, "newPasswordConfirm", 2);
|
|
5340
|
+
f([
|
|
5341
|
+
c()
|
|
5342
|
+
], p.prototype, "showOldPassword", 2);
|
|
5343
|
+
f([
|
|
5344
|
+
c()
|
|
5345
|
+
], p.prototype, "showNewPassword", 2);
|
|
5346
|
+
f([
|
|
5347
|
+
c()
|
|
5348
|
+
], p.prototype, "showNewPasswordConfirm", 2);
|
|
5279
5349
|
f([
|
|
5280
5350
|
c()
|
|
5281
5351
|
], p.prototype, "authenticator", 2);
|
|
@@ -5327,15 +5397,18 @@ f([
|
|
|
5327
5397
|
f([
|
|
5328
5398
|
c()
|
|
5329
5399
|
], p.prototype, "verifyEmailCooldownUntil", 2);
|
|
5400
|
+
f([
|
|
5401
|
+
c()
|
|
5402
|
+
], p.prototype, "verifyPhoneCooldownUntil", 2);
|
|
5330
5403
|
p = f([
|
|
5331
|
-
|
|
5404
|
+
L("authui-account")
|
|
5332
5405
|
], p);
|
|
5333
5406
|
var Jt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, R = (e, t, i, s) => {
|
|
5334
5407
|
for (var a = s > 1 ? void 0 : s ? te(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5335
5408
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5336
5409
|
return s && a && Jt(t, i, a), a;
|
|
5337
5410
|
};
|
|
5338
|
-
let I = class extends
|
|
5411
|
+
let I = class extends E {
|
|
5339
5412
|
constructor() {
|
|
5340
5413
|
super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.scrollCue = !1, this.bodyResizeObserver = null, this.onOpenEvent = (e) => {
|
|
5341
5414
|
const t = e.detail ?? {};
|
|
@@ -5416,7 +5489,7 @@ let I = class extends U {
|
|
|
5416
5489
|
@click=${this.hide}
|
|
5417
5490
|
aria-label=${this.t("close")}
|
|
5418
5491
|
>
|
|
5419
|
-
${
|
|
5492
|
+
${o.x}
|
|
5420
5493
|
</button>
|
|
5421
5494
|
</div>
|
|
5422
5495
|
<div class="body" @scroll=${this.syncScrollCue}>
|
|
@@ -5432,8 +5505,8 @@ let I = class extends U {
|
|
|
5432
5505
|
}
|
|
5433
5506
|
};
|
|
5434
5507
|
I.styles = [
|
|
5435
|
-
...
|
|
5436
|
-
|
|
5508
|
+
...E.styles,
|
|
5509
|
+
T`
|
|
5437
5510
|
:host {
|
|
5438
5511
|
display: contents;
|
|
5439
5512
|
}
|
|
@@ -5556,14 +5629,14 @@ R([
|
|
|
5556
5629
|
at(".body")
|
|
5557
5630
|
], I.prototype, "bodyEl", 2);
|
|
5558
5631
|
I = R([
|
|
5559
|
-
|
|
5632
|
+
L("authui-modal")
|
|
5560
5633
|
], I);
|
|
5561
5634
|
var ee = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, J = (e, t, i, s) => {
|
|
5562
5635
|
for (var a = s > 1 ? void 0 : s ? ie(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5563
5636
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5564
5637
|
return s && a && ee(t, i, a), a;
|
|
5565
5638
|
};
|
|
5566
|
-
let V = class extends
|
|
5639
|
+
let V = class extends E {
|
|
5567
5640
|
constructor() {
|
|
5568
5641
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
5569
5642
|
}
|
|
@@ -5581,8 +5654,8 @@ let V = class extends U {
|
|
|
5581
5654
|
}
|
|
5582
5655
|
};
|
|
5583
5656
|
V.styles = [
|
|
5584
|
-
...
|
|
5585
|
-
|
|
5657
|
+
...E.styles,
|
|
5658
|
+
T`
|
|
5586
5659
|
:host {
|
|
5587
5660
|
display: inline-block;
|
|
5588
5661
|
}
|
|
@@ -5601,14 +5674,14 @@ J([
|
|
|
5601
5674
|
m({ type: String })
|
|
5602
5675
|
], V.prototype, "size", 2);
|
|
5603
5676
|
V = J([
|
|
5604
|
-
|
|
5677
|
+
L("authui-button")
|
|
5605
5678
|
], V);
|
|
5606
5679
|
var se = Object.defineProperty, re = Object.getOwnPropertyDescriptor, F = (e, t, i, s) => {
|
|
5607
5680
|
for (var a = s > 1 ? void 0 : s ? re(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5608
5681
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5609
5682
|
return s && a && se(t, i, a), a;
|
|
5610
5683
|
};
|
|
5611
|
-
let
|
|
5684
|
+
let U = class extends E {
|
|
5612
5685
|
constructor() {
|
|
5613
5686
|
super(...arguments), this.showTeams = !1, this.menuItems = [], this.src = "", this.menuOpen = !1, this.menuAbove = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onReposition = () => {
|
|
5614
5687
|
this.menuOpen && this.placeMenu();
|
|
@@ -5632,7 +5705,7 @@ let E = class extends U {
|
|
|
5632
5705
|
}, this.toggleMenu = () => {
|
|
5633
5706
|
this.menuOpen = !this.menuOpen, this.menuOpen && this.showTeams && this.loadTeams();
|
|
5634
5707
|
}, this.selectTeam = (e) => {
|
|
5635
|
-
|
|
5708
|
+
l.setActiveTeam({ $id: e.$id, name: e.name }), this.activeTeamId = e.$id, this.dispatchEvent(
|
|
5636
5709
|
new CustomEvent("authui-active-team", {
|
|
5637
5710
|
detail: { teamId: e.$id, team: e },
|
|
5638
5711
|
bubbles: !0,
|
|
@@ -5669,9 +5742,9 @@ let E = class extends U {
|
|
|
5669
5742
|
})) : this.menuAbove = !1), this.menuOpen && (e.has("teams") || e.has("teamsLoading")) && requestAnimationFrame(() => this.placeMenu());
|
|
5670
5743
|
}
|
|
5671
5744
|
async loadTeams() {
|
|
5672
|
-
this.teamsLoading = !0, this.activeTeamId =
|
|
5745
|
+
this.teamsLoading = !0, this.activeTeamId = l.getActiveTeamId();
|
|
5673
5746
|
try {
|
|
5674
|
-
this.teams = await
|
|
5747
|
+
this.teams = await l.listTeams(), this.activeTeamId && !this.teams.some((e) => e.$id === this.activeTeamId) && (this.activeTeamId = null, l.setActiveTeam(null));
|
|
5675
5748
|
} catch {
|
|
5676
5749
|
this.teams = [];
|
|
5677
5750
|
} finally {
|
|
@@ -5715,9 +5788,9 @@ let E = class extends U {
|
|
|
5715
5788
|
aria-checked=${a.$id === this.activeTeamId ? "true" : "false"}
|
|
5716
5789
|
@click=${() => this.selectTeam(a)}
|
|
5717
5790
|
>
|
|
5718
|
-
${
|
|
5791
|
+
${o.users}
|
|
5719
5792
|
<span title=${a.name}>${a.name}</span>
|
|
5720
|
-
${a.$id === this.activeTeamId ? r`<span class="check">${
|
|
5793
|
+
${a.$id === this.activeTeamId ? r`<span class="check">${o.check}</span>` : n}
|
|
5721
5794
|
</button>`
|
|
5722
5795
|
)}
|
|
5723
5796
|
</div>` : n}
|
|
@@ -5730,16 +5803,16 @@ let E = class extends U {
|
|
|
5730
5803
|
this.menuOpen = !1, X("account");
|
|
5731
5804
|
}}
|
|
5732
5805
|
>
|
|
5733
|
-
${
|
|
5806
|
+
${o.settings} ${this.t("manageAccount")}
|
|
5734
5807
|
</button>
|
|
5735
5808
|
<button
|
|
5736
5809
|
class="menu-item"
|
|
5737
5810
|
role="menuitem"
|
|
5738
5811
|
@click=${() => {
|
|
5739
|
-
this.menuOpen = !1,
|
|
5812
|
+
this.menuOpen = !1, l.signOut();
|
|
5740
5813
|
}}
|
|
5741
5814
|
>
|
|
5742
|
-
${
|
|
5815
|
+
${o.logOut} ${this.t("signOut")}
|
|
5743
5816
|
</button>
|
|
5744
5817
|
</div>` : n}
|
|
5745
5818
|
`;
|
|
@@ -5781,9 +5854,9 @@ let E = class extends U {
|
|
|
5781
5854
|
}) : n;
|
|
5782
5855
|
}
|
|
5783
5856
|
};
|
|
5784
|
-
|
|
5785
|
-
...
|
|
5786
|
-
|
|
5857
|
+
U.styles = [
|
|
5858
|
+
...E.styles,
|
|
5859
|
+
T`
|
|
5787
5860
|
:host {
|
|
5788
5861
|
display: inline-block;
|
|
5789
5862
|
position: relative;
|
|
@@ -5905,49 +5978,49 @@ E.styles = [
|
|
|
5905
5978
|
];
|
|
5906
5979
|
F([
|
|
5907
5980
|
m({ type: Boolean, attribute: "show-teams" })
|
|
5908
|
-
],
|
|
5981
|
+
], U.prototype, "showTeams", 2);
|
|
5909
5982
|
F([
|
|
5910
5983
|
m({ attribute: !1 })
|
|
5911
|
-
],
|
|
5984
|
+
], U.prototype, "menuItems", 2);
|
|
5912
5985
|
F([
|
|
5913
5986
|
m({ type: String })
|
|
5914
|
-
],
|
|
5987
|
+
], U.prototype, "src", 2);
|
|
5915
5988
|
F([
|
|
5916
5989
|
c()
|
|
5917
|
-
],
|
|
5990
|
+
], U.prototype, "menuOpen", 2);
|
|
5918
5991
|
F([
|
|
5919
5992
|
c()
|
|
5920
|
-
],
|
|
5993
|
+
], U.prototype, "menuAbove", 2);
|
|
5921
5994
|
F([
|
|
5922
5995
|
c()
|
|
5923
|
-
],
|
|
5996
|
+
], U.prototype, "teams", 2);
|
|
5924
5997
|
F([
|
|
5925
5998
|
c()
|
|
5926
|
-
],
|
|
5999
|
+
], U.prototype, "teamsLoading", 2);
|
|
5927
6000
|
F([
|
|
5928
6001
|
c()
|
|
5929
|
-
],
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
],
|
|
6002
|
+
], U.prototype, "activeTeamId", 2);
|
|
6003
|
+
U = F([
|
|
6004
|
+
L("authui-user-button")
|
|
6005
|
+
], U);
|
|
5933
6006
|
export {
|
|
5934
|
-
|
|
6007
|
+
Tt as A,
|
|
5935
6008
|
ce as C,
|
|
5936
6009
|
v as E,
|
|
5937
6010
|
yt as F,
|
|
5938
6011
|
It as P,
|
|
5939
|
-
|
|
6012
|
+
l as a,
|
|
5940
6013
|
p as b,
|
|
5941
6014
|
de as c,
|
|
5942
6015
|
V as d,
|
|
5943
6016
|
w as e,
|
|
5944
|
-
|
|
6017
|
+
E as f,
|
|
5945
6018
|
I as g,
|
|
5946
6019
|
H as h,
|
|
5947
6020
|
$ as i,
|
|
5948
|
-
|
|
6021
|
+
U as j,
|
|
5949
6022
|
le as k,
|
|
5950
|
-
|
|
6023
|
+
ft as l,
|
|
5951
6024
|
St as m,
|
|
5952
6025
|
Y as n,
|
|
5953
6026
|
X as o,
|