@yackey-labs/yauth-ui-vue 0.2.0
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/dist/composables.js +6 -0
- package/dist/index.js +1101 -0
- package/dist/useSession-CnIeOYpZ.js +136 -0
- package/package.json +48 -0
- package/src/components/ChangePasswordForm.test.ts +106 -0
- package/src/components/ChangePasswordForm.vue +131 -0
- package/src/components/ConsentScreen.vue +150 -0
- package/src/components/ForgotPasswordForm.vue +77 -0
- package/src/components/LoginForm.test.ts +163 -0
- package/src/components/LoginForm.vue +128 -0
- package/src/components/MagicLinkForm.vue +80 -0
- package/src/components/MfaChallenge.vue +77 -0
- package/src/components/MfaSetup.vue +155 -0
- package/src/components/OAuthButtons.vue +29 -0
- package/src/components/PasskeyButton.vue +97 -0
- package/src/components/ProfileSettings.vue +423 -0
- package/src/components/RegisterForm.test.ts +116 -0
- package/src/components/RegisterForm.vue +112 -0
- package/src/components/ResetPasswordForm.vue +81 -0
- package/src/components/VerifyEmail.vue +53 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/useAuth.test.ts +154 -0
- package/src/composables/useAuth.ts +139 -0
- package/src/composables/useSession.ts +35 -0
- package/src/index.ts +22 -0
- package/src/provider.test.ts +180 -0
- package/src/provider.ts +66 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1101 @@
|
|
|
1
|
+
import { defineComponent as E, ref as l, openBlock as s, createElementBlock as o, toDisplayString as p, createCommentVNode as g, createElementVNode as e, withDirectives as k, vModelText as $, computed as Y, createTextVNode as J, Fragment as C, renderList as j, createStaticVNode as K, createVNode as G, onMounted as L, unref as U } from "vue";
|
|
2
|
+
import { b as P } from "./useSession-CnIeOYpZ.js";
|
|
3
|
+
import { Y as xs, c as hs, u as ws, a as _s } from "./useSession-CnIeOYpZ.js";
|
|
4
|
+
import { startAuthentication as H, startRegistration as Q } from "@simplewebauthn/browser";
|
|
5
|
+
const W = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
8
|
+
}, X = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400"
|
|
11
|
+
}, Z = { class: "space-y-2" }, ee = ["disabled"], te = { class: "space-y-2" }, se = ["disabled"], oe = { class: "space-y-2" }, ne = ["disabled"], ie = ["disabled"], is = /* @__PURE__ */ E({
|
|
12
|
+
__name: "ChangePasswordForm",
|
|
13
|
+
props: {
|
|
14
|
+
onSuccess: { type: Function },
|
|
15
|
+
onError: { type: Function }
|
|
16
|
+
},
|
|
17
|
+
setup(x) {
|
|
18
|
+
const d = x, { client: b } = P(), m = l(""), a = l(""), v = l(""), i = l(null), n = l(!1), r = l(!1), t = async (u) => {
|
|
19
|
+
if (u.preventDefault(), i.value = null, n.value = !1, a.value !== v.value) {
|
|
20
|
+
i.value = "Passwords do not match";
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
r.value = !0;
|
|
24
|
+
try {
|
|
25
|
+
await b.emailPassword.changePassword(
|
|
26
|
+
m.value,
|
|
27
|
+
a.value
|
|
28
|
+
), n.value = !0, m.value = "", a.value = "", v.value = "", d.onSuccess?.();
|
|
29
|
+
} catch (c) {
|
|
30
|
+
const y = c instanceof Error ? c : new Error(String(c));
|
|
31
|
+
i.value = y.message, d.onError?.(y);
|
|
32
|
+
} finally {
|
|
33
|
+
r.value = !1;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return (u, c) => (s(), o("form", {
|
|
37
|
+
class: "space-y-4",
|
|
38
|
+
onSubmit: t
|
|
39
|
+
}, [
|
|
40
|
+
i.value ? (s(), o("div", W, p(i.value), 1)) : g("", !0),
|
|
41
|
+
n.value ? (s(), o("div", X, " Password changed successfully. ")) : g("", !0),
|
|
42
|
+
e("div", Z, [
|
|
43
|
+
c[3] || (c[3] = e("label", {
|
|
44
|
+
class: "text-sm font-medium leading-none",
|
|
45
|
+
for: "yauth-current-password"
|
|
46
|
+
}, " Current password ", -1)),
|
|
47
|
+
k(e("input", {
|
|
48
|
+
id: "yauth-current-password",
|
|
49
|
+
"onUpdate:modelValue": c[0] || (c[0] = (y) => m.value = y),
|
|
50
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
51
|
+
name: "current_password",
|
|
52
|
+
type: "password",
|
|
53
|
+
required: "",
|
|
54
|
+
autocomplete: "current-password",
|
|
55
|
+
disabled: r.value
|
|
56
|
+
}, null, 8, ee), [
|
|
57
|
+
[$, m.value]
|
|
58
|
+
])
|
|
59
|
+
]),
|
|
60
|
+
e("div", te, [
|
|
61
|
+
c[4] || (c[4] = e("label", {
|
|
62
|
+
class: "text-sm font-medium leading-none",
|
|
63
|
+
for: "yauth-new-password"
|
|
64
|
+
}, " New password ", -1)),
|
|
65
|
+
k(e("input", {
|
|
66
|
+
id: "yauth-new-password",
|
|
67
|
+
"onUpdate:modelValue": c[1] || (c[1] = (y) => a.value = y),
|
|
68
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
69
|
+
name: "new_password",
|
|
70
|
+
type: "password",
|
|
71
|
+
required: "",
|
|
72
|
+
autocomplete: "new-password",
|
|
73
|
+
disabled: r.value
|
|
74
|
+
}, null, 8, se), [
|
|
75
|
+
[$, a.value]
|
|
76
|
+
])
|
|
77
|
+
]),
|
|
78
|
+
e("div", oe, [
|
|
79
|
+
c[5] || (c[5] = e("label", {
|
|
80
|
+
class: "text-sm font-medium leading-none",
|
|
81
|
+
for: "yauth-confirm-password"
|
|
82
|
+
}, " Confirm new password ", -1)),
|
|
83
|
+
k(e("input", {
|
|
84
|
+
id: "yauth-confirm-password",
|
|
85
|
+
"onUpdate:modelValue": c[2] || (c[2] = (y) => v.value = y),
|
|
86
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
87
|
+
name: "confirm_password",
|
|
88
|
+
type: "password",
|
|
89
|
+
required: "",
|
|
90
|
+
autocomplete: "new-password",
|
|
91
|
+
disabled: r.value
|
|
92
|
+
}, null, 8, ne), [
|
|
93
|
+
[$, v.value]
|
|
94
|
+
])
|
|
95
|
+
]),
|
|
96
|
+
e("button", {
|
|
97
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
98
|
+
type: "submit",
|
|
99
|
+
disabled: r.value
|
|
100
|
+
}, p(r.value ? "Changing password..." : "Change password"), 9, ie)
|
|
101
|
+
], 32));
|
|
102
|
+
}
|
|
103
|
+
}), re = { class: "mx-auto max-w-md space-y-6 p-6" }, ae = { class: "space-y-2 text-center" }, le = { class: "text-2xl font-semibold tracking-tight" }, de = { class: "text-sm text-muted-foreground" }, ue = {
|
|
104
|
+
key: 0,
|
|
105
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
106
|
+
}, ce = {
|
|
107
|
+
key: 1,
|
|
108
|
+
class: "space-y-3 rounded-md border p-4"
|
|
109
|
+
}, me = { class: "space-y-2" }, pe = { class: "flex gap-3" }, ve = ["disabled"], fe = ["disabled"], rs = /* @__PURE__ */ E({
|
|
110
|
+
__name: "ConsentScreen",
|
|
111
|
+
props: {
|
|
112
|
+
clientName: {},
|
|
113
|
+
clientId: {},
|
|
114
|
+
scopes: {},
|
|
115
|
+
redirectUri: {},
|
|
116
|
+
responseType: {},
|
|
117
|
+
codeChallenge: {},
|
|
118
|
+
codeChallengeMethod: {},
|
|
119
|
+
state: {},
|
|
120
|
+
onSubmit: { type: Function },
|
|
121
|
+
onError: { type: Function },
|
|
122
|
+
authBaseUrl: {}
|
|
123
|
+
},
|
|
124
|
+
setup(x) {
|
|
125
|
+
const d = x, b = l(!1), m = l(null), a = Y(() => d.clientName ?? d.clientId), v = async (i) => {
|
|
126
|
+
m.value = null, b.value = !0;
|
|
127
|
+
try {
|
|
128
|
+
const n = d.authBaseUrl ?? "/api/auth", r = await fetch(`${n}/authorize`, {
|
|
129
|
+
method: "POST",
|
|
130
|
+
headers: { "Content-Type": "application/json" },
|
|
131
|
+
credentials: "include",
|
|
132
|
+
body: JSON.stringify({
|
|
133
|
+
client_id: d.clientId,
|
|
134
|
+
redirect_uri: d.redirectUri,
|
|
135
|
+
response_type: d.responseType,
|
|
136
|
+
code_challenge: d.codeChallenge,
|
|
137
|
+
code_challenge_method: d.codeChallengeMethod,
|
|
138
|
+
scope: d.scopes?.join(" "),
|
|
139
|
+
state: d.state,
|
|
140
|
+
approved: i
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
if (r.redirected) {
|
|
144
|
+
window.location.href = r.url;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!r.ok) {
|
|
148
|
+
const u = await r.json().catch(() => null);
|
|
149
|
+
throw new Error(
|
|
150
|
+
u?.error_description ?? u?.error ?? "Authorization failed"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
const t = r.headers.get("Location");
|
|
154
|
+
if (t) {
|
|
155
|
+
window.location.href = t;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
d.onSubmit?.(i);
|
|
159
|
+
} catch (n) {
|
|
160
|
+
const r = n instanceof Error ? n : new Error(String(n));
|
|
161
|
+
m.value = r.message, d.onError?.(r);
|
|
162
|
+
} finally {
|
|
163
|
+
b.value = !1;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return (i, n) => (s(), o("div", re, [
|
|
167
|
+
e("div", ae, [
|
|
168
|
+
e("h2", le, " Authorize " + p(a.value), 1),
|
|
169
|
+
e("p", de, [
|
|
170
|
+
e("strong", null, p(a.value), 1),
|
|
171
|
+
n[2] || (n[2] = J(" is requesting access to your account. ", -1))
|
|
172
|
+
])
|
|
173
|
+
]),
|
|
174
|
+
m.value ? (s(), o("div", ue, p(m.value), 1)) : g("", !0),
|
|
175
|
+
x.scopes && x.scopes.length > 0 ? (s(), o("div", ce, [
|
|
176
|
+
n[4] || (n[4] = e("p", { class: "text-sm font-medium" }, " This application is requesting the following permissions: ", -1)),
|
|
177
|
+
e("ul", me, [
|
|
178
|
+
(s(!0), o(C, null, j(x.scopes, (r) => (s(), o("li", {
|
|
179
|
+
key: r,
|
|
180
|
+
class: "flex items-center gap-2 text-sm"
|
|
181
|
+
}, [
|
|
182
|
+
n[3] || (n[3] = e("svg", {
|
|
183
|
+
class: "h-4 w-4 text-primary",
|
|
184
|
+
fill: "none",
|
|
185
|
+
stroke: "currentColor",
|
|
186
|
+
viewBox: "0 0 24 24",
|
|
187
|
+
"aria-label": "Checkmark",
|
|
188
|
+
role: "img"
|
|
189
|
+
}, [
|
|
190
|
+
e("path", {
|
|
191
|
+
"stroke-linecap": "round",
|
|
192
|
+
"stroke-linejoin": "round",
|
|
193
|
+
"stroke-width": "2",
|
|
194
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
195
|
+
})
|
|
196
|
+
], -1)),
|
|
197
|
+
e("span", null, p(r), 1)
|
|
198
|
+
]))), 128))
|
|
199
|
+
])
|
|
200
|
+
])) : g("", !0),
|
|
201
|
+
e("div", pe, [
|
|
202
|
+
e("button", {
|
|
203
|
+
class: "inline-flex h-9 flex-1 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
204
|
+
type: "button",
|
|
205
|
+
disabled: b.value,
|
|
206
|
+
onClick: n[0] || (n[0] = (r) => v(!1))
|
|
207
|
+
}, " Deny ", 8, ve),
|
|
208
|
+
e("button", {
|
|
209
|
+
class: "inline-flex h-9 flex-1 cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
210
|
+
type: "button",
|
|
211
|
+
disabled: b.value,
|
|
212
|
+
onClick: n[1] || (n[1] = (r) => v(!0))
|
|
213
|
+
}, p(b.value ? "Authorizing..." : "Authorize"), 9, fe)
|
|
214
|
+
]),
|
|
215
|
+
n[5] || (n[5] = e("p", { class: "text-center text-xs text-muted-foreground" }, " By authorizing, you allow this application to access your account with the permissions listed above. ", -1))
|
|
216
|
+
]));
|
|
217
|
+
}
|
|
218
|
+
}), be = {
|
|
219
|
+
key: 0,
|
|
220
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
221
|
+
}, ye = {
|
|
222
|
+
key: 1,
|
|
223
|
+
class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400"
|
|
224
|
+
}, ge = { class: "space-y-2" }, xe = ["disabled"], he = ["disabled"], as = /* @__PURE__ */ E({
|
|
225
|
+
__name: "ForgotPasswordForm",
|
|
226
|
+
props: {
|
|
227
|
+
onSuccess: { type: Function }
|
|
228
|
+
},
|
|
229
|
+
setup(x) {
|
|
230
|
+
const d = x, { client: b } = P(), m = l(""), a = l(null), v = l(null), i = l(!1), n = async (r) => {
|
|
231
|
+
r.preventDefault(), a.value = null, v.value = null, i.value = !0;
|
|
232
|
+
try {
|
|
233
|
+
const t = await b.emailPassword.forgotPassword(m.value);
|
|
234
|
+
v.value = t.message, d.onSuccess?.(t.message);
|
|
235
|
+
} catch (t) {
|
|
236
|
+
const u = t instanceof Error ? t : new Error(String(t));
|
|
237
|
+
a.value = u.message;
|
|
238
|
+
} finally {
|
|
239
|
+
i.value = !1;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
return (r, t) => (s(), o("form", {
|
|
243
|
+
class: "space-y-4",
|
|
244
|
+
onSubmit: n
|
|
245
|
+
}, [
|
|
246
|
+
a.value ? (s(), o("div", be, p(a.value), 1)) : g("", !0),
|
|
247
|
+
v.value ? (s(), o("div", ye, p(v.value), 1)) : g("", !0),
|
|
248
|
+
e("div", ge, [
|
|
249
|
+
t[1] || (t[1] = e("label", {
|
|
250
|
+
class: "text-sm font-medium leading-none",
|
|
251
|
+
for: "yauth-forgot-password-email"
|
|
252
|
+
}, " Email ", -1)),
|
|
253
|
+
k(e("input", {
|
|
254
|
+
id: "yauth-forgot-password-email",
|
|
255
|
+
"onUpdate:modelValue": t[0] || (t[0] = (u) => m.value = u),
|
|
256
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
257
|
+
name: "email",
|
|
258
|
+
type: "email",
|
|
259
|
+
required: "",
|
|
260
|
+
autocomplete: "email",
|
|
261
|
+
disabled: i.value
|
|
262
|
+
}, null, 8, xe), [
|
|
263
|
+
[$, m.value]
|
|
264
|
+
])
|
|
265
|
+
]),
|
|
266
|
+
e("button", {
|
|
267
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
268
|
+
type: "submit",
|
|
269
|
+
disabled: i.value
|
|
270
|
+
}, p(i.value ? "Sending..." : "Send reset link"), 9, he)
|
|
271
|
+
], 32));
|
|
272
|
+
}
|
|
273
|
+
}), we = { class: "space-y-2" }, _e = {
|
|
274
|
+
key: 0,
|
|
275
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
276
|
+
}, ke = ["disabled"], $e = /* @__PURE__ */ E({
|
|
277
|
+
__name: "PasskeyButton",
|
|
278
|
+
props: {
|
|
279
|
+
mode: {},
|
|
280
|
+
email: {},
|
|
281
|
+
onSuccess: { type: Function },
|
|
282
|
+
onError: { type: Function }
|
|
283
|
+
},
|
|
284
|
+
setup(x) {
|
|
285
|
+
const d = x, { client: b } = P(), m = l(null), a = l(!1), v = async () => {
|
|
286
|
+
const t = await b.passkey.loginBegin(d.email || void 0), u = t.options, c = await H({
|
|
287
|
+
optionsJSON: u.publicKey
|
|
288
|
+
});
|
|
289
|
+
await b.passkey.loginFinish(t.challenge_id, c);
|
|
290
|
+
const y = await b.getSession();
|
|
291
|
+
d.onSuccess?.(y.user);
|
|
292
|
+
}, i = async () => {
|
|
293
|
+
const t = await b.passkey.registerBegin(), u = await Q({
|
|
294
|
+
optionsJSON: t.publicKey
|
|
295
|
+
});
|
|
296
|
+
await b.passkey.registerFinish(u, "Passkey"), d.onSuccess?.(void 0);
|
|
297
|
+
}, n = async () => {
|
|
298
|
+
m.value = null, a.value = !0;
|
|
299
|
+
try {
|
|
300
|
+
d.mode === "login" ? await v() : await i();
|
|
301
|
+
} catch (t) {
|
|
302
|
+
const u = t instanceof Error ? t : new Error(String(t));
|
|
303
|
+
console.error("[yauth] Passkey error:", u);
|
|
304
|
+
const c = u.name === "NotAllowedError" ? "Passkey authentication was cancelled or not available on this device." : u.message;
|
|
305
|
+
m.value = c, d.onError?.(u);
|
|
306
|
+
} finally {
|
|
307
|
+
a.value = !1;
|
|
308
|
+
}
|
|
309
|
+
}, r = () => a.value ? d.mode === "login" ? "Authenticating..." : "Registering..." : d.mode === "login" ? "Sign in with passkey" : "Register passkey";
|
|
310
|
+
return (t, u) => (s(), o("div", we, [
|
|
311
|
+
m.value ? (s(), o("div", _e, p(m.value), 1)) : g("", !0),
|
|
312
|
+
e("button", {
|
|
313
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
314
|
+
type: "button",
|
|
315
|
+
disabled: a.value,
|
|
316
|
+
onClick: n
|
|
317
|
+
}, p(r()), 9, ke)
|
|
318
|
+
]));
|
|
319
|
+
}
|
|
320
|
+
}), Se = {
|
|
321
|
+
key: 0,
|
|
322
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
323
|
+
}, Ee = { class: "space-y-2" }, Ce = ["disabled"], Pe = { class: "space-y-2" }, Fe = ["disabled"], Ve = ["disabled"], ls = /* @__PURE__ */ E({
|
|
324
|
+
__name: "LoginForm",
|
|
325
|
+
props: {
|
|
326
|
+
onSuccess: { type: Function },
|
|
327
|
+
onMfaRequired: { type: Function },
|
|
328
|
+
onError: { type: Function },
|
|
329
|
+
showPasskey: { type: Boolean }
|
|
330
|
+
},
|
|
331
|
+
setup(x) {
|
|
332
|
+
const d = x, { client: b, refetch: m } = P(), a = l(""), v = l(""), i = l(null), n = l(!1), r = async (u) => {
|
|
333
|
+
u.preventDefault(), i.value = null, n.value = !0;
|
|
334
|
+
try {
|
|
335
|
+
const c = await b.emailPassword.login({
|
|
336
|
+
email: a.value,
|
|
337
|
+
password: v.value
|
|
338
|
+
});
|
|
339
|
+
if ("mfa_required" in c && c.mfa_required)
|
|
340
|
+
d.onMfaRequired?.(c.pending_session_id);
|
|
341
|
+
else {
|
|
342
|
+
const y = await m();
|
|
343
|
+
d.onSuccess?.(y);
|
|
344
|
+
}
|
|
345
|
+
} catch (c) {
|
|
346
|
+
const y = c instanceof Error ? c : new Error(String(c));
|
|
347
|
+
i.value = y.message, d.onError?.(y);
|
|
348
|
+
} finally {
|
|
349
|
+
n.value = !1;
|
|
350
|
+
}
|
|
351
|
+
}, t = (u) => {
|
|
352
|
+
m(), d.onSuccess?.(u);
|
|
353
|
+
};
|
|
354
|
+
return (u, c) => (s(), o("form", {
|
|
355
|
+
class: "space-y-6",
|
|
356
|
+
onSubmit: r
|
|
357
|
+
}, [
|
|
358
|
+
i.value ? (s(), o("div", Se, p(i.value), 1)) : g("", !0),
|
|
359
|
+
e("div", Ee, [
|
|
360
|
+
c[2] || (c[2] = e("label", {
|
|
361
|
+
class: "text-sm font-medium leading-none",
|
|
362
|
+
for: "yauth-login-email"
|
|
363
|
+
}, " Email ", -1)),
|
|
364
|
+
k(e("input", {
|
|
365
|
+
id: "yauth-login-email",
|
|
366
|
+
"onUpdate:modelValue": c[0] || (c[0] = (y) => a.value = y),
|
|
367
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
368
|
+
name: "email",
|
|
369
|
+
type: "email",
|
|
370
|
+
required: "",
|
|
371
|
+
autocomplete: "email",
|
|
372
|
+
disabled: n.value
|
|
373
|
+
}, null, 8, Ce), [
|
|
374
|
+
[$, a.value]
|
|
375
|
+
])
|
|
376
|
+
]),
|
|
377
|
+
e("div", Pe, [
|
|
378
|
+
c[3] || (c[3] = e("label", {
|
|
379
|
+
class: "text-sm font-medium leading-none",
|
|
380
|
+
for: "yauth-login-password"
|
|
381
|
+
}, " Password ", -1)),
|
|
382
|
+
k(e("input", {
|
|
383
|
+
id: "yauth-login-password",
|
|
384
|
+
"onUpdate:modelValue": c[1] || (c[1] = (y) => v.value = y),
|
|
385
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
386
|
+
name: "password",
|
|
387
|
+
type: "password",
|
|
388
|
+
required: "",
|
|
389
|
+
autocomplete: "current-password",
|
|
390
|
+
disabled: n.value
|
|
391
|
+
}, null, 8, Fe), [
|
|
392
|
+
[$, v.value]
|
|
393
|
+
])
|
|
394
|
+
]),
|
|
395
|
+
e("button", {
|
|
396
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
397
|
+
type: "submit",
|
|
398
|
+
disabled: n.value
|
|
399
|
+
}, p(n.value ? "Signing in..." : "Sign in"), 9, Ve),
|
|
400
|
+
x.showPasskey ? (s(), o(C, { key: 1 }, [
|
|
401
|
+
c[4] || (c[4] = K('<div class="relative"><div class="absolute inset-0 flex items-center" style="pointer-events:none;"><span class="w-full border-t"></span></div><div class="relative flex justify-center text-xs uppercase"><span class="bg-background px-2 text-muted-foreground">or</span></div></div>', 1)),
|
|
402
|
+
G($e, {
|
|
403
|
+
mode: "login",
|
|
404
|
+
email: a.value,
|
|
405
|
+
"on-success": t,
|
|
406
|
+
"on-error": x.onError
|
|
407
|
+
}, null, 8, ["email", "on-error"])
|
|
408
|
+
], 64)) : g("", !0)
|
|
409
|
+
], 32));
|
|
410
|
+
}
|
|
411
|
+
}), Ue = {
|
|
412
|
+
key: 0,
|
|
413
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
414
|
+
}, Ae = {
|
|
415
|
+
key: 1,
|
|
416
|
+
class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400"
|
|
417
|
+
}, je = { class: "space-y-2" }, De = ["disabled"], qe = ["disabled"], ds = /* @__PURE__ */ E({
|
|
418
|
+
__name: "MagicLinkForm",
|
|
419
|
+
props: {
|
|
420
|
+
onSuccess: { type: Function }
|
|
421
|
+
},
|
|
422
|
+
setup(x) {
|
|
423
|
+
const d = x, { client: b } = P(), m = l(""), a = l(null), v = l(null), i = l(!1), n = async (r) => {
|
|
424
|
+
r.preventDefault(), a.value = null, v.value = null, i.value = !0;
|
|
425
|
+
try {
|
|
426
|
+
const t = await b.magicLink.send(m.value);
|
|
427
|
+
v.value = t.message, d.onSuccess?.(t.message);
|
|
428
|
+
} catch (t) {
|
|
429
|
+
const u = t instanceof Error ? t : new Error(String(t));
|
|
430
|
+
a.value = u.message;
|
|
431
|
+
} finally {
|
|
432
|
+
i.value = !1;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
return (r, t) => (s(), o("form", {
|
|
436
|
+
class: "space-y-4",
|
|
437
|
+
onSubmit: n
|
|
438
|
+
}, [
|
|
439
|
+
a.value ? (s(), o("div", Ue, p(a.value), 1)) : g("", !0),
|
|
440
|
+
v.value ? (s(), o("div", Ae, p(v.value), 1)) : g("", !0),
|
|
441
|
+
v.value ? g("", !0) : (s(), o(C, { key: 2 }, [
|
|
442
|
+
e("div", je, [
|
|
443
|
+
t[1] || (t[1] = e("label", {
|
|
444
|
+
class: "text-sm font-medium leading-none",
|
|
445
|
+
for: "yauth-magic-link-email"
|
|
446
|
+
}, " Email ", -1)),
|
|
447
|
+
k(e("input", {
|
|
448
|
+
id: "yauth-magic-link-email",
|
|
449
|
+
"onUpdate:modelValue": t[0] || (t[0] = (u) => m.value = u),
|
|
450
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
451
|
+
name: "email",
|
|
452
|
+
type: "email",
|
|
453
|
+
required: "",
|
|
454
|
+
autocomplete: "email",
|
|
455
|
+
disabled: i.value,
|
|
456
|
+
placeholder: "you@example.com"
|
|
457
|
+
}, null, 8, De), [
|
|
458
|
+
[$, m.value]
|
|
459
|
+
])
|
|
460
|
+
]),
|
|
461
|
+
e("button", {
|
|
462
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
463
|
+
type: "submit",
|
|
464
|
+
disabled: i.value
|
|
465
|
+
}, p(i.value ? "Sending..." : "Send magic link"), 9, qe)
|
|
466
|
+
], 64))
|
|
467
|
+
], 32));
|
|
468
|
+
}
|
|
469
|
+
}), Me = {
|
|
470
|
+
key: 0,
|
|
471
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
472
|
+
}, Le = { class: "space-y-2" }, Ne = ["disabled"], Re = ["disabled"], us = /* @__PURE__ */ E({
|
|
473
|
+
__name: "MfaChallenge",
|
|
474
|
+
props: {
|
|
475
|
+
pendingSessionId: {},
|
|
476
|
+
onSuccess: { type: Function },
|
|
477
|
+
onError: { type: Function }
|
|
478
|
+
},
|
|
479
|
+
setup(x) {
|
|
480
|
+
const d = x, { client: b } = P(), m = l(""), a = l(null), v = l(!1), i = async (n) => {
|
|
481
|
+
n.preventDefault(), a.value = null, v.value = !0;
|
|
482
|
+
try {
|
|
483
|
+
await b.mfa.verify(d.pendingSessionId, m.value);
|
|
484
|
+
const r = await b.getSession();
|
|
485
|
+
d.onSuccess?.(r.user);
|
|
486
|
+
} catch (r) {
|
|
487
|
+
const t = r instanceof Error ? r : new Error(String(r));
|
|
488
|
+
a.value = t.message, d.onError?.(t);
|
|
489
|
+
} finally {
|
|
490
|
+
v.value = !1;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
return (n, r) => (s(), o("form", {
|
|
494
|
+
class: "space-y-4",
|
|
495
|
+
onSubmit: i
|
|
496
|
+
}, [
|
|
497
|
+
a.value ? (s(), o("div", Me, p(a.value), 1)) : g("", !0),
|
|
498
|
+
r[2] || (r[2] = e("p", { class: "text-sm text-muted-foreground" }, " Enter the code from your authenticator app, or use a backup code. ", -1)),
|
|
499
|
+
e("div", Le, [
|
|
500
|
+
r[1] || (r[1] = e("label", {
|
|
501
|
+
class: "text-sm font-medium leading-none",
|
|
502
|
+
for: "yauth-mfa-challenge-code"
|
|
503
|
+
}, " Verification code ", -1)),
|
|
504
|
+
k(e("input", {
|
|
505
|
+
id: "yauth-mfa-challenge-code",
|
|
506
|
+
"onUpdate:modelValue": r[0] || (r[0] = (t) => m.value = t),
|
|
507
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
508
|
+
name: "code",
|
|
509
|
+
type: "text",
|
|
510
|
+
inputmode: "numeric",
|
|
511
|
+
autocomplete: "one-time-code",
|
|
512
|
+
required: "",
|
|
513
|
+
disabled: v.value
|
|
514
|
+
}, null, 8, Ne), [
|
|
515
|
+
[$, m.value]
|
|
516
|
+
])
|
|
517
|
+
]),
|
|
518
|
+
e("button", {
|
|
519
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
520
|
+
type: "submit",
|
|
521
|
+
disabled: v.value
|
|
522
|
+
}, p(v.value ? "Verifying..." : "Verify"), 9, Re)
|
|
523
|
+
], 32));
|
|
524
|
+
}
|
|
525
|
+
}), Be = { class: "space-y-4" }, Te = {
|
|
526
|
+
key: 0,
|
|
527
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
528
|
+
}, Oe = {
|
|
529
|
+
key: 1,
|
|
530
|
+
class: "space-y-4"
|
|
531
|
+
}, ze = ["disabled"], Ie = {
|
|
532
|
+
key: 2,
|
|
533
|
+
class: "space-y-4"
|
|
534
|
+
}, Ye = { class: "space-y-1" }, Je = { class: "block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs" }, Ke = { class: "space-y-1" }, Ge = { class: "block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs font-mono tracking-wider" }, He = { class: "space-y-2" }, Qe = ["disabled"], We = ["disabled"], Xe = {
|
|
535
|
+
key: 3,
|
|
536
|
+
class: "space-y-4"
|
|
537
|
+
}, Ze = { class: "space-y-1" }, cs = /* @__PURE__ */ E({
|
|
538
|
+
__name: "MfaSetup",
|
|
539
|
+
props: {
|
|
540
|
+
onComplete: { type: Function }
|
|
541
|
+
},
|
|
542
|
+
setup(x) {
|
|
543
|
+
const d = x, { client: b } = P(), m = l("begin"), a = l(""), v = l(""), i = l(""), n = l([]), r = l(null), t = l(!1), u = async () => {
|
|
544
|
+
r.value = null, t.value = !0;
|
|
545
|
+
try {
|
|
546
|
+
const y = await b.mfa.setup();
|
|
547
|
+
a.value = y.otpauth_url, v.value = y.secret, n.value = y.backup_codes, m.value = "confirm";
|
|
548
|
+
} catch (y) {
|
|
549
|
+
const h = y instanceof Error ? y : new Error(String(y));
|
|
550
|
+
r.value = h.message;
|
|
551
|
+
} finally {
|
|
552
|
+
t.value = !1;
|
|
553
|
+
}
|
|
554
|
+
}, c = async (y) => {
|
|
555
|
+
y.preventDefault(), r.value = null, t.value = !0;
|
|
556
|
+
try {
|
|
557
|
+
await b.mfa.confirm(i.value), m.value = "done", d.onComplete?.(n.value);
|
|
558
|
+
} catch (h) {
|
|
559
|
+
const F = h instanceof Error ? h : new Error(String(h));
|
|
560
|
+
r.value = F.message;
|
|
561
|
+
} finally {
|
|
562
|
+
t.value = !1;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
return (y, h) => (s(), o("div", Be, [
|
|
566
|
+
r.value ? (s(), o("div", Te, p(r.value), 1)) : g("", !0),
|
|
567
|
+
m.value === "begin" ? (s(), o("div", Oe, [
|
|
568
|
+
h[1] || (h[1] = e("p", { class: "text-sm text-muted-foreground" }, " Set up two-factor authentication to secure your account. ", -1)),
|
|
569
|
+
e("button", {
|
|
570
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
571
|
+
type: "button",
|
|
572
|
+
disabled: t.value,
|
|
573
|
+
onClick: u
|
|
574
|
+
}, p(t.value ? "Setting up..." : "Set up 2FA"), 9, ze)
|
|
575
|
+
])) : g("", !0),
|
|
576
|
+
m.value === "confirm" ? (s(), o("div", Ie, [
|
|
577
|
+
h[5] || (h[5] = e("p", { class: "text-sm text-muted-foreground" }, " Add this account to your authenticator app using the URI below, then enter the verification code. ", -1)),
|
|
578
|
+
e("div", Ye, [
|
|
579
|
+
h[2] || (h[2] = e("span", { class: "text-sm font-medium leading-none" }, "OTP Auth URI", -1)),
|
|
580
|
+
e("code", Je, p(a.value), 1)
|
|
581
|
+
]),
|
|
582
|
+
e("div", Ke, [
|
|
583
|
+
h[3] || (h[3] = e("span", { class: "text-sm font-medium leading-none" }, " Manual entry key ", -1)),
|
|
584
|
+
e("code", Ge, p(v.value), 1)
|
|
585
|
+
]),
|
|
586
|
+
e("form", {
|
|
587
|
+
class: "space-y-4",
|
|
588
|
+
onSubmit: c
|
|
589
|
+
}, [
|
|
590
|
+
e("div", He, [
|
|
591
|
+
h[4] || (h[4] = e("label", {
|
|
592
|
+
class: "text-sm font-medium leading-none",
|
|
593
|
+
for: "yauth-mfa-setup-code"
|
|
594
|
+
}, " Verification code ", -1)),
|
|
595
|
+
k(e("input", {
|
|
596
|
+
id: "yauth-mfa-setup-code",
|
|
597
|
+
"onUpdate:modelValue": h[0] || (h[0] = (F) => i.value = F),
|
|
598
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
599
|
+
name: "code",
|
|
600
|
+
type: "text",
|
|
601
|
+
inputmode: "numeric",
|
|
602
|
+
autocomplete: "one-time-code",
|
|
603
|
+
required: "",
|
|
604
|
+
disabled: t.value
|
|
605
|
+
}, null, 8, Qe), [
|
|
606
|
+
[$, i.value]
|
|
607
|
+
])
|
|
608
|
+
]),
|
|
609
|
+
e("button", {
|
|
610
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
611
|
+
type: "submit",
|
|
612
|
+
disabled: t.value
|
|
613
|
+
}, p(t.value ? "Verifying..." : "Verify and enable"), 9, We)
|
|
614
|
+
], 32)
|
|
615
|
+
])) : g("", !0),
|
|
616
|
+
m.value === "done" ? (s(), o("div", Xe, [
|
|
617
|
+
h[6] || (h[6] = e("div", { class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400" }, " Two-factor authentication has been enabled. Save these backup codes in a safe place. Each code can only be used once. ", -1)),
|
|
618
|
+
e("ul", Ze, [
|
|
619
|
+
(s(!0), o(C, null, j(n.value, (F) => (s(), o("li", {
|
|
620
|
+
key: F,
|
|
621
|
+
class: "rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider"
|
|
622
|
+
}, p(F), 1))), 128))
|
|
623
|
+
])
|
|
624
|
+
])) : g("", !0)
|
|
625
|
+
]));
|
|
626
|
+
}
|
|
627
|
+
}), et = { class: "space-y-2" }, tt = ["onClick"], ms = /* @__PURE__ */ E({
|
|
628
|
+
__name: "OAuthButtons",
|
|
629
|
+
props: {
|
|
630
|
+
providers: {}
|
|
631
|
+
},
|
|
632
|
+
setup(x) {
|
|
633
|
+
const { client: d } = P(), b = (a) => {
|
|
634
|
+
d.oauth.authorize(a);
|
|
635
|
+
}, m = (a) => a.charAt(0).toUpperCase() + a.slice(1);
|
|
636
|
+
return (a, v) => (s(), o("div", et, [
|
|
637
|
+
(s(!0), o(C, null, j(x.providers, (i) => (s(), o("button", {
|
|
638
|
+
key: i,
|
|
639
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
640
|
+
type: "button",
|
|
641
|
+
onClick: (n) => b(i)
|
|
642
|
+
}, " Sign in with " + p(m(i)), 9, tt))), 128))
|
|
643
|
+
]));
|
|
644
|
+
}
|
|
645
|
+
}), st = { class: "space-y-8" }, ot = {
|
|
646
|
+
key: 0,
|
|
647
|
+
class: "text-sm text-muted-foreground"
|
|
648
|
+
}, nt = { class: "space-y-4" }, it = { class: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm" }, rt = { class: "space-y-4" }, at = {
|
|
649
|
+
key: 0,
|
|
650
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
651
|
+
}, lt = {
|
|
652
|
+
key: 1,
|
|
653
|
+
class: "text-sm text-muted-foreground"
|
|
654
|
+
}, dt = {
|
|
655
|
+
key: 0,
|
|
656
|
+
class: "text-sm text-muted-foreground"
|
|
657
|
+
}, ut = {
|
|
658
|
+
key: 1,
|
|
659
|
+
class: "space-y-2"
|
|
660
|
+
}, ct = { class: "space-y-0.5" }, mt = { class: "text-sm font-medium" }, pt = { class: "block text-xs text-muted-foreground" }, vt = ["disabled", "onClick"], ft = { class: "space-y-4" }, bt = {
|
|
661
|
+
key: 0,
|
|
662
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
663
|
+
}, yt = {
|
|
664
|
+
key: 1,
|
|
665
|
+
class: "text-sm text-muted-foreground"
|
|
666
|
+
}, gt = {
|
|
667
|
+
key: 0,
|
|
668
|
+
class: "text-sm text-muted-foreground"
|
|
669
|
+
}, xt = {
|
|
670
|
+
key: 1,
|
|
671
|
+
class: "space-y-2"
|
|
672
|
+
}, ht = { class: "space-y-0.5" }, wt = { class: "text-sm font-medium" }, _t = { class: "block text-xs text-muted-foreground" }, kt = ["disabled", "onClick"], $t = { class: "space-y-4" }, St = {
|
|
673
|
+
key: 0,
|
|
674
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
675
|
+
}, Et = {
|
|
676
|
+
key: 1,
|
|
677
|
+
class: "flex gap-2"
|
|
678
|
+
}, Ct = ["disabled"], Pt = ["disabled"], Ft = {
|
|
679
|
+
key: 2,
|
|
680
|
+
class: "space-y-4"
|
|
681
|
+
}, Vt = { class: "space-y-1" }, Ut = { class: "block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs" }, At = { class: "space-y-1" }, jt = { class: "block w-full break-all rounded-md border border-input bg-muted px-3 py-2 text-xs font-mono tracking-wider" }, Dt = { class: "space-y-2" }, qt = ["disabled"], Mt = ["disabled"], Lt = {
|
|
682
|
+
key: 3,
|
|
683
|
+
class: "space-y-4"
|
|
684
|
+
}, Nt = { class: "space-y-1" }, ps = /* @__PURE__ */ E({
|
|
685
|
+
__name: "ProfileSettings",
|
|
686
|
+
setup(x) {
|
|
687
|
+
const { client: d, user: b, loading: m } = P(), a = l([]), v = l(!0), i = l(null), n = l(null), r = l([]), t = l(!0), u = l(null), c = l(null), y = l(""), h = l(""), F = l(""), D = l([]), A = l("idle"), V = l(null), S = l(!1), q = async () => {
|
|
688
|
+
v.value = !0;
|
|
689
|
+
try {
|
|
690
|
+
a.value = await d.passkey.list();
|
|
691
|
+
} catch {
|
|
692
|
+
a.value = [];
|
|
693
|
+
} finally {
|
|
694
|
+
v.value = !1;
|
|
695
|
+
}
|
|
696
|
+
}, M = async () => {
|
|
697
|
+
t.value = !0;
|
|
698
|
+
try {
|
|
699
|
+
r.value = await d.oauth.accounts();
|
|
700
|
+
} catch {
|
|
701
|
+
r.value = [];
|
|
702
|
+
} finally {
|
|
703
|
+
t.value = !1;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
L(() => {
|
|
707
|
+
q(), M();
|
|
708
|
+
});
|
|
709
|
+
const N = async (_) => {
|
|
710
|
+
i.value = null, n.value = _;
|
|
711
|
+
try {
|
|
712
|
+
await d.passkey.delete(_), await q();
|
|
713
|
+
} catch (f) {
|
|
714
|
+
const w = f instanceof Error ? f : new Error(String(f));
|
|
715
|
+
i.value = w.message;
|
|
716
|
+
} finally {
|
|
717
|
+
n.value = null;
|
|
718
|
+
}
|
|
719
|
+
}, R = async (_) => {
|
|
720
|
+
u.value = null, c.value = _;
|
|
721
|
+
try {
|
|
722
|
+
await d.oauth.unlink(_), await M();
|
|
723
|
+
} catch (f) {
|
|
724
|
+
const w = f instanceof Error ? f : new Error(String(f));
|
|
725
|
+
u.value = w.message;
|
|
726
|
+
} finally {
|
|
727
|
+
c.value = null;
|
|
728
|
+
}
|
|
729
|
+
}, B = async () => {
|
|
730
|
+
V.value = null, S.value = !0;
|
|
731
|
+
try {
|
|
732
|
+
const _ = await d.mfa.setup();
|
|
733
|
+
y.value = _.otpauth_url, h.value = _.secret, D.value = _.backup_codes, A.value = "confirm";
|
|
734
|
+
} catch (_) {
|
|
735
|
+
const f = _ instanceof Error ? _ : new Error(String(_));
|
|
736
|
+
V.value = f.message;
|
|
737
|
+
} finally {
|
|
738
|
+
S.value = !1;
|
|
739
|
+
}
|
|
740
|
+
}, T = async (_) => {
|
|
741
|
+
_.preventDefault(), V.value = null, S.value = !0;
|
|
742
|
+
try {
|
|
743
|
+
await d.mfa.confirm(F.value), A.value = "done";
|
|
744
|
+
} catch (f) {
|
|
745
|
+
const w = f instanceof Error ? f : new Error(String(f));
|
|
746
|
+
V.value = w.message;
|
|
747
|
+
} finally {
|
|
748
|
+
S.value = !1;
|
|
749
|
+
}
|
|
750
|
+
}, O = async () => {
|
|
751
|
+
V.value = null, S.value = !0;
|
|
752
|
+
try {
|
|
753
|
+
await d.mfa.disable(), A.value = "idle", y.value = "", h.value = "", F.value = "", D.value = [];
|
|
754
|
+
} catch (_) {
|
|
755
|
+
const f = _ instanceof Error ? _ : new Error(String(_));
|
|
756
|
+
V.value = f.message;
|
|
757
|
+
} finally {
|
|
758
|
+
S.value = !1;
|
|
759
|
+
}
|
|
760
|
+
}, z = (_) => _.charAt(0).toUpperCase() + _.slice(1);
|
|
761
|
+
return (_, f) => (s(), o("div", st, [
|
|
762
|
+
U(m) ? (s(), o("div", ot, " Loading profile... ")) : g("", !0),
|
|
763
|
+
U(b) ? (s(), o(C, { key: 1 }, [
|
|
764
|
+
e("section", nt, [
|
|
765
|
+
f[5] || (f[5] = e("h2", { class: "text-lg font-semibold tracking-tight" }, "Profile", -1)),
|
|
766
|
+
e("dl", it, [
|
|
767
|
+
f[2] || (f[2] = e("dt", { class: "font-medium text-muted-foreground" }, "Email", -1)),
|
|
768
|
+
e("dd", null, p(U(b).email), 1),
|
|
769
|
+
U(b).display_name ? (s(), o(C, { key: 0 }, [
|
|
770
|
+
f[1] || (f[1] = e("dt", { class: "font-medium text-muted-foreground" }, " Display name ", -1)),
|
|
771
|
+
e("dd", null, p(U(b).display_name), 1)
|
|
772
|
+
], 64)) : g("", !0),
|
|
773
|
+
f[3] || (f[3] = e("dt", { class: "font-medium text-muted-foreground" }, " Email verified ", -1)),
|
|
774
|
+
e("dd", null, p(U(b).email_verified ? "Yes" : "No"), 1),
|
|
775
|
+
f[4] || (f[4] = e("dt", { class: "font-medium text-muted-foreground" }, "Role", -1)),
|
|
776
|
+
e("dd", null, p(U(b).role), 1)
|
|
777
|
+
])
|
|
778
|
+
]),
|
|
779
|
+
e("section", rt, [
|
|
780
|
+
f[6] || (f[6] = e("h2", { class: "text-lg font-semibold tracking-tight" }, "Passkeys", -1)),
|
|
781
|
+
i.value ? (s(), o("div", at, p(i.value), 1)) : g("", !0),
|
|
782
|
+
v.value ? (s(), o("div", lt, " Loading passkeys... ")) : (s(), o(C, { key: 2 }, [
|
|
783
|
+
a.value.length === 0 ? (s(), o("p", dt, " No passkeys registered. ")) : (s(), o("ul", ut, [
|
|
784
|
+
(s(!0), o(C, null, j(a.value, (w) => (s(), o("li", {
|
|
785
|
+
key: w.id,
|
|
786
|
+
class: "flex items-center justify-between rounded-md border border-input px-3 py-2"
|
|
787
|
+
}, [
|
|
788
|
+
e("div", ct, [
|
|
789
|
+
e("span", mt, p(w.name ?? "Unnamed passkey"), 1),
|
|
790
|
+
e("span", pt, " Added " + p(new Date(
|
|
791
|
+
w.created_at
|
|
792
|
+
).toLocaleDateString()), 1)
|
|
793
|
+
]),
|
|
794
|
+
e("button", {
|
|
795
|
+
class: "inline-flex h-8 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
796
|
+
type: "button",
|
|
797
|
+
disabled: n.value === w.id,
|
|
798
|
+
onClick: (I) => N(w.id)
|
|
799
|
+
}, p(n.value === w.id ? "Deleting..." : "Delete"), 9, vt)
|
|
800
|
+
]))), 128))
|
|
801
|
+
]))
|
|
802
|
+
], 64))
|
|
803
|
+
]),
|
|
804
|
+
e("section", ft, [
|
|
805
|
+
f[7] || (f[7] = e("h2", { class: "text-lg font-semibold tracking-tight" }, " Connected accounts ", -1)),
|
|
806
|
+
u.value ? (s(), o("div", bt, p(u.value), 1)) : g("", !0),
|
|
807
|
+
t.value ? (s(), o("div", yt, " Loading accounts... ")) : (s(), o(C, { key: 2 }, [
|
|
808
|
+
r.value.length === 0 ? (s(), o("p", gt, " No connected accounts. ")) : (s(), o("ul", xt, [
|
|
809
|
+
(s(!0), o(C, null, j(r.value, (w) => (s(), o("li", {
|
|
810
|
+
key: w.provider,
|
|
811
|
+
class: "flex items-center justify-between rounded-md border border-input px-3 py-2"
|
|
812
|
+
}, [
|
|
813
|
+
e("div", ht, [
|
|
814
|
+
e("span", wt, p(z(w.provider)), 1),
|
|
815
|
+
e("span", _t, " Connected " + p(new Date(
|
|
816
|
+
w.created_at
|
|
817
|
+
).toLocaleDateString()), 1)
|
|
818
|
+
]),
|
|
819
|
+
e("button", {
|
|
820
|
+
class: "inline-flex h-8 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
821
|
+
type: "button",
|
|
822
|
+
disabled: c.value === w.provider,
|
|
823
|
+
onClick: (I) => R(w.provider)
|
|
824
|
+
}, p(c.value === w.provider ? "Unlinking..." : "Unlink"), 9, kt)
|
|
825
|
+
]))), 128))
|
|
826
|
+
]))
|
|
827
|
+
], 64))
|
|
828
|
+
]),
|
|
829
|
+
e("section", $t, [
|
|
830
|
+
f[13] || (f[13] = e("h2", { class: "text-lg font-semibold tracking-tight" }, " Two-factor authentication ", -1)),
|
|
831
|
+
V.value ? (s(), o("div", St, p(V.value), 1)) : g("", !0),
|
|
832
|
+
A.value === "idle" ? (s(), o("div", Et, [
|
|
833
|
+
e("button", {
|
|
834
|
+
class: "inline-flex h-9 cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
835
|
+
type: "button",
|
|
836
|
+
disabled: S.value,
|
|
837
|
+
onClick: B
|
|
838
|
+
}, p(S.value ? "Setting up..." : "Set up 2FA"), 9, Ct),
|
|
839
|
+
e("button", {
|
|
840
|
+
class: "inline-flex h-9 cursor-pointer items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-destructive hover:text-destructive-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
841
|
+
type: "button",
|
|
842
|
+
disabled: S.value,
|
|
843
|
+
onClick: O
|
|
844
|
+
}, p(S.value ? "Disabling..." : "Disable 2FA"), 9, Pt)
|
|
845
|
+
])) : g("", !0),
|
|
846
|
+
A.value === "confirm" ? (s(), o("div", Ft, [
|
|
847
|
+
f[11] || (f[11] = e("p", { class: "text-sm text-muted-foreground" }, " Add this account to your authenticator app, then enter the verification code. ", -1)),
|
|
848
|
+
e("div", Vt, [
|
|
849
|
+
f[8] || (f[8] = e("span", { class: "text-sm font-medium leading-none" }, " OTP Auth URI ", -1)),
|
|
850
|
+
e("code", Ut, p(y.value), 1)
|
|
851
|
+
]),
|
|
852
|
+
e("div", At, [
|
|
853
|
+
f[9] || (f[9] = e("span", { class: "text-sm font-medium leading-none" }, " Manual entry key ", -1)),
|
|
854
|
+
e("code", jt, p(h.value), 1)
|
|
855
|
+
]),
|
|
856
|
+
e("form", {
|
|
857
|
+
class: "space-y-4",
|
|
858
|
+
onSubmit: T
|
|
859
|
+
}, [
|
|
860
|
+
e("div", Dt, [
|
|
861
|
+
f[10] || (f[10] = e("label", {
|
|
862
|
+
class: "text-sm font-medium leading-none",
|
|
863
|
+
for: "yauth-profile-mfa-code"
|
|
864
|
+
}, " Verification code ", -1)),
|
|
865
|
+
k(e("input", {
|
|
866
|
+
id: "yauth-profile-mfa-code",
|
|
867
|
+
"onUpdate:modelValue": f[0] || (f[0] = (w) => F.value = w),
|
|
868
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
869
|
+
name: "mfa_code",
|
|
870
|
+
type: "text",
|
|
871
|
+
inputmode: "numeric",
|
|
872
|
+
autocomplete: "one-time-code",
|
|
873
|
+
required: "",
|
|
874
|
+
disabled: S.value
|
|
875
|
+
}, null, 8, qt), [
|
|
876
|
+
[$, F.value]
|
|
877
|
+
])
|
|
878
|
+
]),
|
|
879
|
+
e("button", {
|
|
880
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
881
|
+
type: "submit",
|
|
882
|
+
disabled: S.value
|
|
883
|
+
}, p(S.value ? "Verifying..." : "Verify and enable"), 9, Mt)
|
|
884
|
+
], 32)
|
|
885
|
+
])) : g("", !0),
|
|
886
|
+
A.value === "done" ? (s(), o("div", Lt, [
|
|
887
|
+
f[12] || (f[12] = e("div", { class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400" }, " Two-factor authentication is enabled. Save these backup codes in a safe place. ", -1)),
|
|
888
|
+
e("ul", Nt, [
|
|
889
|
+
(s(!0), o(C, null, j(D.value, (w) => (s(), o("li", {
|
|
890
|
+
key: w,
|
|
891
|
+
class: "rounded-md border border-input bg-muted px-3 py-1.5 text-center font-mono text-sm tracking-wider"
|
|
892
|
+
}, p(w), 1))), 128))
|
|
893
|
+
])
|
|
894
|
+
])) : g("", !0)
|
|
895
|
+
])
|
|
896
|
+
], 64)) : g("", !0)
|
|
897
|
+
]));
|
|
898
|
+
}
|
|
899
|
+
}), Rt = {
|
|
900
|
+
key: 0,
|
|
901
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
902
|
+
}, Bt = { class: "space-y-2" }, Tt = ["disabled"], Ot = { class: "space-y-2" }, zt = ["disabled"], It = { class: "space-y-2" }, Yt = ["disabled"], Jt = ["disabled"], vs = /* @__PURE__ */ E({
|
|
903
|
+
__name: "RegisterForm",
|
|
904
|
+
props: {
|
|
905
|
+
onSuccess: { type: Function },
|
|
906
|
+
onError: { type: Function }
|
|
907
|
+
},
|
|
908
|
+
setup(x) {
|
|
909
|
+
const d = x, { client: b } = P(), m = l(""), a = l(""), v = l(""), i = l(null), n = l(!1), r = async (t) => {
|
|
910
|
+
t.preventDefault(), i.value = null, n.value = !0;
|
|
911
|
+
try {
|
|
912
|
+
const u = await b.emailPassword.register({
|
|
913
|
+
email: m.value,
|
|
914
|
+
password: a.value,
|
|
915
|
+
display_name: v.value || void 0
|
|
916
|
+
});
|
|
917
|
+
d.onSuccess?.(u.message);
|
|
918
|
+
} catch (u) {
|
|
919
|
+
const c = u instanceof Error ? u : new Error(String(u));
|
|
920
|
+
i.value = c.message, d.onError?.(c);
|
|
921
|
+
} finally {
|
|
922
|
+
n.value = !1;
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
return (t, u) => (s(), o("form", {
|
|
926
|
+
class: "space-y-6",
|
|
927
|
+
onSubmit: r
|
|
928
|
+
}, [
|
|
929
|
+
i.value ? (s(), o("div", Rt, p(i.value), 1)) : g("", !0),
|
|
930
|
+
e("div", Bt, [
|
|
931
|
+
u[3] || (u[3] = e("label", {
|
|
932
|
+
class: "text-sm font-medium leading-none",
|
|
933
|
+
for: "yauth-register-email"
|
|
934
|
+
}, " Email ", -1)),
|
|
935
|
+
k(e("input", {
|
|
936
|
+
id: "yauth-register-email",
|
|
937
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => m.value = c),
|
|
938
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
939
|
+
name: "email",
|
|
940
|
+
type: "email",
|
|
941
|
+
required: "",
|
|
942
|
+
autocomplete: "email",
|
|
943
|
+
disabled: n.value
|
|
944
|
+
}, null, 8, Tt), [
|
|
945
|
+
[$, m.value]
|
|
946
|
+
])
|
|
947
|
+
]),
|
|
948
|
+
e("div", Ot, [
|
|
949
|
+
u[4] || (u[4] = e("label", {
|
|
950
|
+
class: "text-sm font-medium leading-none",
|
|
951
|
+
for: "yauth-register-password"
|
|
952
|
+
}, " Password ", -1)),
|
|
953
|
+
k(e("input", {
|
|
954
|
+
id: "yauth-register-password",
|
|
955
|
+
"onUpdate:modelValue": u[1] || (u[1] = (c) => a.value = c),
|
|
956
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
957
|
+
name: "password",
|
|
958
|
+
type: "password",
|
|
959
|
+
required: "",
|
|
960
|
+
autocomplete: "new-password",
|
|
961
|
+
disabled: n.value
|
|
962
|
+
}, null, 8, zt), [
|
|
963
|
+
[$, a.value]
|
|
964
|
+
])
|
|
965
|
+
]),
|
|
966
|
+
e("div", It, [
|
|
967
|
+
u[5] || (u[5] = e("label", {
|
|
968
|
+
class: "text-sm font-medium leading-none",
|
|
969
|
+
for: "yauth-register-display-name"
|
|
970
|
+
}, " Display name (optional) ", -1)),
|
|
971
|
+
k(e("input", {
|
|
972
|
+
id: "yauth-register-display-name",
|
|
973
|
+
"onUpdate:modelValue": u[2] || (u[2] = (c) => v.value = c),
|
|
974
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
975
|
+
name: "display_name",
|
|
976
|
+
type: "text",
|
|
977
|
+
autocomplete: "name",
|
|
978
|
+
disabled: n.value
|
|
979
|
+
}, null, 8, Yt), [
|
|
980
|
+
[$, v.value]
|
|
981
|
+
])
|
|
982
|
+
]),
|
|
983
|
+
e("button", {
|
|
984
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
985
|
+
type: "submit",
|
|
986
|
+
disabled: n.value
|
|
987
|
+
}, p(n.value ? "Creating account..." : "Create account"), 9, Jt)
|
|
988
|
+
], 32));
|
|
989
|
+
}
|
|
990
|
+
}), Kt = {
|
|
991
|
+
key: 0,
|
|
992
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
993
|
+
}, Gt = {
|
|
994
|
+
key: 1,
|
|
995
|
+
class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400"
|
|
996
|
+
}, Ht = { class: "space-y-2" }, Qt = ["disabled"], Wt = ["disabled"], fs = /* @__PURE__ */ E({
|
|
997
|
+
__name: "ResetPasswordForm",
|
|
998
|
+
props: {
|
|
999
|
+
token: {},
|
|
1000
|
+
onSuccess: { type: Function }
|
|
1001
|
+
},
|
|
1002
|
+
setup(x) {
|
|
1003
|
+
const d = x, { client: b } = P(), m = l(""), a = l(null), v = l(null), i = l(!1), n = async (r) => {
|
|
1004
|
+
r.preventDefault(), a.value = null, v.value = null, i.value = !0;
|
|
1005
|
+
try {
|
|
1006
|
+
const t = await b.emailPassword.resetPassword(
|
|
1007
|
+
d.token,
|
|
1008
|
+
m.value
|
|
1009
|
+
);
|
|
1010
|
+
v.value = t.message, d.onSuccess?.(t.message);
|
|
1011
|
+
} catch (t) {
|
|
1012
|
+
const u = t instanceof Error ? t : new Error(String(t));
|
|
1013
|
+
a.value = u.message;
|
|
1014
|
+
} finally {
|
|
1015
|
+
i.value = !1;
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
return (r, t) => (s(), o("form", {
|
|
1019
|
+
class: "space-y-4",
|
|
1020
|
+
onSubmit: n
|
|
1021
|
+
}, [
|
|
1022
|
+
a.value ? (s(), o("div", Kt, p(a.value), 1)) : g("", !0),
|
|
1023
|
+
v.value ? (s(), o("div", Gt, p(v.value), 1)) : g("", !0),
|
|
1024
|
+
e("div", Ht, [
|
|
1025
|
+
t[1] || (t[1] = e("label", {
|
|
1026
|
+
class: "text-sm font-medium leading-none",
|
|
1027
|
+
for: "yauth-reset-password-input"
|
|
1028
|
+
}, " New password ", -1)),
|
|
1029
|
+
k(e("input", {
|
|
1030
|
+
id: "yauth-reset-password-input",
|
|
1031
|
+
"onUpdate:modelValue": t[0] || (t[0] = (u) => m.value = u),
|
|
1032
|
+
class: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1033
|
+
name: "password",
|
|
1034
|
+
type: "password",
|
|
1035
|
+
required: "",
|
|
1036
|
+
autocomplete: "new-password",
|
|
1037
|
+
disabled: i.value
|
|
1038
|
+
}, null, 8, Qt), [
|
|
1039
|
+
[$, m.value]
|
|
1040
|
+
])
|
|
1041
|
+
]),
|
|
1042
|
+
e("button", {
|
|
1043
|
+
class: "inline-flex h-9 w-full cursor-pointer items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
1044
|
+
type: "submit",
|
|
1045
|
+
disabled: i.value
|
|
1046
|
+
}, p(i.value ? "Resetting..." : "Reset password"), 9, Wt)
|
|
1047
|
+
], 32));
|
|
1048
|
+
}
|
|
1049
|
+
}), Xt = { class: "space-y-4" }, Zt = {
|
|
1050
|
+
key: 0,
|
|
1051
|
+
class: "text-sm text-muted-foreground"
|
|
1052
|
+
}, es = {
|
|
1053
|
+
key: 1,
|
|
1054
|
+
class: "rounded-md bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400"
|
|
1055
|
+
}, ts = {
|
|
1056
|
+
key: 2,
|
|
1057
|
+
class: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
1058
|
+
}, bs = /* @__PURE__ */ E({
|
|
1059
|
+
__name: "VerifyEmail",
|
|
1060
|
+
props: {
|
|
1061
|
+
token: {},
|
|
1062
|
+
onSuccess: { type: Function },
|
|
1063
|
+
onError: { type: Function }
|
|
1064
|
+
},
|
|
1065
|
+
setup(x) {
|
|
1066
|
+
const d = x, { client: b } = P(), m = l("loading"), a = l(""), v = l("");
|
|
1067
|
+
return L(async () => {
|
|
1068
|
+
try {
|
|
1069
|
+
const i = await b.emailPassword.verify(d.token);
|
|
1070
|
+
a.value = i.message, m.value = "success", d.onSuccess?.();
|
|
1071
|
+
} catch (i) {
|
|
1072
|
+
const n = i instanceof Error ? i : new Error(String(i));
|
|
1073
|
+
v.value = n.message, m.value = "error", d.onError?.(n);
|
|
1074
|
+
}
|
|
1075
|
+
}), (i, n) => (s(), o("div", Xt, [
|
|
1076
|
+
m.value === "loading" ? (s(), o("div", Zt, " Verifying your email address... ")) : g("", !0),
|
|
1077
|
+
m.value === "success" ? (s(), o("div", es, p(a.value), 1)) : g("", !0),
|
|
1078
|
+
m.value === "error" ? (s(), o("div", ts, p(v.value), 1)) : g("", !0)
|
|
1079
|
+
]));
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
export {
|
|
1083
|
+
is as ChangePasswordForm,
|
|
1084
|
+
rs as ConsentScreen,
|
|
1085
|
+
as as ForgotPasswordForm,
|
|
1086
|
+
ls as LoginForm,
|
|
1087
|
+
ds as MagicLinkForm,
|
|
1088
|
+
us as MfaChallenge,
|
|
1089
|
+
cs as MfaSetup,
|
|
1090
|
+
ms as OAuthButtons,
|
|
1091
|
+
$e as PasskeyButton,
|
|
1092
|
+
ps as ProfileSettings,
|
|
1093
|
+
vs as RegisterForm,
|
|
1094
|
+
fs as ResetPasswordForm,
|
|
1095
|
+
bs as VerifyEmail,
|
|
1096
|
+
xs as YAuthKey,
|
|
1097
|
+
hs as YAuthPlugin,
|
|
1098
|
+
ws as useAuth,
|
|
1099
|
+
_s as useSession,
|
|
1100
|
+
P as useYAuth
|
|
1101
|
+
};
|