@huyooo/ui 1.0.6 → 2.0.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.
Files changed (75) hide show
  1. package/dist/AuthkitAppSetting-rtYZcSAR.js +2677 -0
  2. package/dist/{Contact-BWuVR9ho.js → Contact-CcWf3UEZ.js} +9 -9
  3. package/dist/{CustomTable-BzGfaAVH.js → CustomTable-HDwqEcmB.js} +1 -1
  4. package/dist/FeedbackModal.vue_vue_type_script_setup_true_lang-DpOmbAg-.js +1491 -0
  5. package/dist/{LegalDocViewer-DM8FYBpf.js → LegalDocViewer-C0tsIbz9.js} +747 -748
  6. package/dist/MessageHandle-BUufez4S.js +1233 -0
  7. package/dist/{MessageList-Ce-_LNTk.js → MessageList-rttvPmxV.js} +4 -4
  8. package/dist/PaySubscriptions-p75aBnHm.js +1331 -0
  9. package/dist/{PricingPlans-CV97ck9p.js → PricingPlans-CQ0qk9Hb.js} +99 -105
  10. package/dist/{ReferrerReferees-DgygiIiE.js → ReferrerReferees-BU9IEQgz.js} +47 -46
  11. package/dist/Upload.vue_vue_type_script_setup_true_lang-bh0NFq9E.js +78 -0
  12. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-zgjpFVln.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-DG4AuHiO.js} +64 -65
  13. package/dist/WidthContainer-DSE4QbW0.js +717 -0
  14. package/dist/api/billingSubscriptionApi.d.ts +4 -1
  15. package/dist/apiClients-Ctcq8NZs.js +245 -0
  16. package/dist/authkit.js +10 -10
  17. package/dist/common/globalConfig.d.ts +36 -18
  18. package/dist/common.js +2 -2
  19. package/dist/components/Authkit/Auth/AuthkitOauthCallback.vue.d.ts +2 -2
  20. package/dist/components/Authkit/AuthkitProvider.vue.d.ts +0 -5
  21. package/dist/components/Feedback/FeedbackDetails.vue.d.ts +30 -0
  22. package/dist/components/Upload/Upload.vue.d.ts +6 -6
  23. package/dist/composables/Authkit/useAuthkitAuth.d.ts +3 -0
  24. package/dist/composables/Billing/usePaymentReturn.d.ts +1 -0
  25. package/dist/composables/uploadFeedbackAttachment.d.ts +2 -1
  26. package/dist/composables/useMessageList.d.ts +2 -1
  27. package/dist/composables.d.ts +2 -2
  28. package/dist/composables.js +46 -46
  29. package/dist/feedback.js +2 -2
  30. package/dist/{fetchAuthPageAboutUs-dzTSwRsB.js → fetchAuthPageAboutUs-DiCqMUX3.js} +4 -4
  31. package/dist/{index-BkLvw1PU.js → index-Cn6LcfZO.js} +1 -1
  32. package/dist/legalDocs/resolveAppId.d.ts +1 -1
  33. package/dist/main.d.ts +4 -3
  34. package/dist/main.js +464 -469
  35. package/dist/message.js +53 -52
  36. package/dist/pay.js +4 -4
  37. package/dist/privateCom.js +1 -1
  38. package/dist/referrer.js +1 -1
  39. package/dist/{useUploadCos-C8BqFPkx.js → runtime-BzCSCUNv.js} +2712 -2609
  40. package/dist/runtime.d.ts +18 -0
  41. package/dist/style.css +1 -1
  42. package/dist/types/api/auth.generated.d.ts +0 -10
  43. package/dist/upload/browserCosTransport.d.ts +25 -0
  44. package/dist/upload/browserUploadService.d.ts +20 -0
  45. package/dist/upload.d.ts +2 -1
  46. package/dist/upload.js +5 -4
  47. package/dist/{useAuthkitAppsAuthPageInfo-CNudJd04.js → useAuthkitAppsAuthPageInfo-DZ1p-P3Q.js} +18 -21
  48. package/dist/useAuthkitAuth-BPTZUSkM.js +272 -0
  49. package/dist/{useAuthkitCreateAndUpdate-BsINsI-E.js → useAuthkitCreateAndUpdate-Bbv7vZZn.js} +1 -1
  50. package/dist/useAuthkitUsersProfile-CW_exa7E.js +39 -0
  51. package/dist/useBillingStatusOptions-Br-iL77Z.js +61 -0
  52. package/dist/{useEnsureAuthenticated-DNkCCy_Y.js → useEnsureAuthenticated-CncOvj2H.js} +2 -2
  53. package/dist/{useLegalDocs-DQP_Yq6B.js → useLegalDocs-D44qU_q0.js} +25 -25
  54. package/dist/useMessageNotifications-D9uikt21.js +80 -0
  55. package/dist/{useRoutePermission-CEiya9AM.js → useRoutePermission-BrQX7NTq.js} +2 -2
  56. package/dist/{useSEO-CDWxbk8B.js → useSEO-_TNouXE_.js} +89 -86
  57. package/dist/useSubscriptionCheckout-BDDCRxSs.js +353 -0
  58. package/dist/user.js +1 -1
  59. package/dist/utils/apiClients.d.ts +20 -12
  60. package/dist/utils/apiMiddlewares.d.ts +9 -23
  61. package/package.json +1 -1
  62. package/dist/AuthkitAppSetting-BN8-xgNq.js +0 -2674
  63. package/dist/FeedbackModal.vue_vue_type_script_setup_true_lang-B9BqGWm8.js +0 -1480
  64. package/dist/MessageHandle-mEkCsv9e.js +0 -1173
  65. package/dist/PaySubscriptions-CXkEjqr2.js +0 -1326
  66. package/dist/Upload.vue_vue_type_script_setup_true_lang-VGh2V4o0.js +0 -76
  67. package/dist/WidthContainer-PeWkCK0p.js +0 -721
  68. package/dist/apiClients-BcXOLuYu.js +0 -272
  69. package/dist/composables/Upload/useUploadCos.d.ts +0 -12
  70. package/dist/useAuthkitAuth-3m0yW6uP.js +0 -267
  71. package/dist/useAuthkitUsersProfile-DJlMsftY.js +0 -40
  72. package/dist/useBillingStatusOptions-CfHQOFNw.js +0 -71
  73. package/dist/useMessageNotifications-CAphguOm.js +0 -75
  74. package/dist/useSubscriptionCheckout-d_M_rKRa.js +0 -368
  75. package/dist/utils/billingFetch.d.ts +0 -1
@@ -1,2674 +0,0 @@
1
- /* empty css */
2
- /* empty css */
3
- import { U as Ue } from "./userMenuModal-D-nDaYqM.js";
4
- import { defineComponent as Y, ref as _, computed as S, openBlock as v, createElementBlock as M, createElementVNode as k, createVNode as p, unref as t, withCtx as l, createTextVNode as b, createCommentVNode as C, toDisplayString as T, createBlock as A, onUnmounted as ke, withDirectives as xe, vShow as Oe, onMounted as ue, Fragment as te, createSlots as Ne, normalizeClass as ze, renderList as De, watch as Ae } from "vue";
5
- import { Avatar as Pe, Input as Q, Textarea as qe, Button as $, Message as J, Form as oe, FormItem as L, Alert as G, Space as pe, Popconfirm as Be, Link as Ce, InputPassword as Le, Result as Me, Modal as Ke } from "@arco-design/web-vue";
6
- /* empty css */
7
- import { q as Fe, e as x, g as re, v as He, x as Ie } from "./apiClients-BcXOLuYu.js";
8
- import { C as We } from "./index-BkLvw1PU.js";
9
- /* empty css */
10
- import { u as Ge } from "./useUploadCos-C8BqFPkx.js";
11
- import { u as ie } from "./useAuthkitUsersProfile-DJlMsftY.js";
12
- import { _ as Z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
13
- /* empty css */
14
- /* empty css */
15
- import { C as Je } from "./CustomTable-BzGfaAVH.js";
16
- import { u as Ee } from "./useAuthkitAppsAuthPageInfo-CNudJd04.js";
17
- import { Icon as Ye } from "@iconify/vue";
18
- import { i as je, M as Qe } from "./Menu-uCexrsKP.js";
19
- import { u as Xe } from "./useAuthkitAuth-3m0yW6uP.js";
20
- import { u as Ze } from "./useAuthkitCreateAndUpdate-BsINsI-E.js";
21
- const et = {
22
- class: "personal-information"
23
- }, tt = {
24
- class: "profile-card"
25
- }, it = {
26
- class: "profile-field profile-field--nickname"
27
- }, nt = {
28
- class: "nickname-field"
29
- }, at = ["disabled"], ot = {
30
- class: "profile-field"
31
- }, st = {
32
- key: 0,
33
- class: "profile-actions"
34
- }, lt = {
35
- class: "profile-card profile-card--meta"
36
- }, rt = {
37
- class: "account-meta"
38
- }, ut = {
39
- class: "account-meta__row"
40
- }, dt = {
41
- class: "account-meta__row"
42
- }, ct = {
43
- class: "account-meta__row"
44
- }, ft = {
45
- class: "account-meta__row"
46
- }, pt = 1e3, mt = /* @__PURE__ */ Y({
47
- __name: "AuthkitPersonalInformation",
48
- props: {
49
- size: {
50
- type: String,
51
- required: !0
52
- }
53
- },
54
- emits: ["submit"],
55
- setup(i, {
56
- emit: e
57
- }) {
58
- const s = e, {
59
- fetchUserProfile: c
60
- } = ie(), u = i, o = _({
61
- id: void 0,
62
- nickname: "",
63
- description: "",
64
- avatar: "",
65
- avatarUrl: "",
66
- email: "",
67
- phone: ""
68
- }), r = _({
69
- nickname: "",
70
- description: ""
71
- }), n = _({
72
- id: "",
73
- createAt: "",
74
- status: "",
75
- loginIdentity: "-"
76
- }), g = _(!1), y = _(!1), f = S(() => o.value.nickname !== r.value.nickname || o.value.description !== r.value.description);
77
- function h() {
78
- r.value = {
79
- nickname: o.value.nickname,
80
- description: o.value.description
81
- };
82
- }
83
- function d(V) {
84
- o.value.id = V.id, o.value.nickname = V.nickname, o.value.description = V.description, o.value.avatar = V.avatar, o.value.avatarUrl = V.avatarUrl, o.value.email = V.email, o.value.phone = V.phone, n.value = {
85
- id: V.id,
86
- createAt: V.createAt || "-",
87
- status: V.status || "",
88
- loginIdentity: He(V)
89
- }, h();
90
- }
91
- async function m() {
92
- y.value = !0;
93
- const {
94
- data: V
95
- } = await x.users.profile.post({});
96
- y.value = !1, V && d(V);
97
- }
98
- function I() {
99
- o.value.nickname = r.value.nickname, o.value.description = r.value.description;
100
- }
101
- async function E() {
102
- if (!o.value.id)
103
- return;
104
- y.value = !0;
105
- const V = {
106
- id: o.value.id,
107
- nickname: o.value.nickname,
108
- description: o.value.description,
109
- avatar: o.value.avatar
110
- }, {
111
- data: P,
112
- error: D
113
- } = await x.users.update.baseInfo.post(V);
114
- y.value = !1, !D && P && (J.success("更新成功"), o.value.avatarUrl = P.avatarUrl || o.value.avatarUrl, h(), await c(), s("submit"));
115
- }
116
- function q() {
117
- const {
118
- uploadFile: V
119
- } = Ge(), P = document.createElement("input");
120
- P.type = "file", P.accept = "image/*", P.style.display = "none", document.body.append(P), P.addEventListener("change", async (D) => {
121
- var w;
122
- const j = (w = D.target.files) == null ? void 0 : w[0];
123
- if (!j || !o.value.id) {
124
- P.remove();
125
- return;
126
- }
127
- g.value = !0;
128
- try {
129
- V({
130
- bucketId: re.avatarBucketId,
131
- file: j,
132
- onFileFinish(z, K, F) {
133
- const B = {
134
- id: o.value.id,
135
- nickname: o.value.nickname,
136
- description: o.value.description,
137
- avatar: F.Key
138
- };
139
- (async () => {
140
- const {
141
- error: X
142
- } = await x.users.update.baseInfo.post(B);
143
- g.value = !1, X || (J.success("头像已更新"), await m(), await c(), s("submit"));
144
- })();
145
- },
146
- onError() {
147
- g.value = !1;
148
- }
149
- });
150
- } catch {
151
- g.value = !1;
152
- }
153
- P.remove();
154
- }), P.click();
155
- }
156
- return m(), (V, P) => (v(), M("div", et, [k("section", tt, [P[6] || (P[6] = k("h3", {
157
- class: "profile-card__title"
158
- }, "个人资料", -1)), k("div", it, [P[2] || (P[2] = k("label", {
159
- class: "profile-field__label"
160
- }, "昵称", -1)), k("div", nt, [k("button", {
161
- type: "button",
162
- class: "nickname-field__avatar",
163
- disabled: g.value,
164
- title: "更换头像",
165
- onClick: q
166
- }, [p(t(Pe), {
167
- "image-url": o.value.avatarUrl,
168
- size: 28,
169
- "object-fit": "cover"
170
- }, null, 8, ["image-url"])], 8, at), p(t(Q), {
171
- modelValue: o.value.nickname,
172
- "onUpdate:modelValue": P[0] || (P[0] = (D) => o.value.nickname = D),
173
- class: "nickname-field__input",
174
- size: u.size,
175
- placeholder: "例如:小明"
176
- }, null, 8, ["modelValue", "size"])])]), k("div", ot, [P[3] || (P[3] = k("label", {
177
- class: "profile-field__label"
178
- }, "个人简介", -1)), p(t(qe), {
179
- modelValue: o.value.description,
180
- "onUpdate:modelValue": P[1] || (P[1] = (D) => o.value.description = D),
181
- size: u.size,
182
- placeholder: "介绍一下你自己",
183
- "max-length": pt,
184
- "show-word-limit": "",
185
- "auto-size": {
186
- minRows: 4,
187
- maxRows: 8
188
- }
189
- }, null, 8, ["modelValue", "size"])]), f.value ? (v(), M("div", st, [p(t($), {
190
- size: u.size,
191
- onClick: I
192
- }, {
193
- default: l(() => [...P[4] || (P[4] = [b("取消", -1)])]),
194
- _: 1
195
- }, 8, ["size"]), p(t($), {
196
- type: "primary",
197
- size: u.size,
198
- loading: y.value,
199
- onClick: E
200
- }, {
201
- default: l(() => [...P[5] || (P[5] = [b(" 保存修改 ", -1)])]),
202
- _: 1
203
- }, 8, ["size", "loading"])])) : C("", !0)]), k("section", lt, [P[11] || (P[11] = k("h3", {
204
- class: "profile-card__title"
205
- }, "账号信息", -1)), k("dl", rt, [k("div", ut, [P[7] || (P[7] = k("dt", null, "用户 ID", -1)), k("dd", null, [k("span", null, T(n.value.id || "-"), 1), n.value.id ? (v(), A(We, {
206
- key: 0,
207
- value: n.value.id,
208
- message: "用户 ID 已复制"
209
- }, null, 8, ["value"])) : C("", !0)])]), k("div", dt, [P[8] || (P[8] = k("dt", null, "注册时间", -1)), k("dd", null, T(n.value.createAt || "-"), 1)]), k("div", ct, [P[9] || (P[9] = k("dt", null, "账号状态", -1)), k("dd", null, T(t(Fe)(n.value.status)), 1)]), k("div", ft, [P[10] || (P[10] = k("dt", null, "登录标识", -1)), k("dd", null, T(n.value.loginIdentity), 1)])])])]));
210
- }
211
- }), vt = /* @__PURE__ */ Z(mt, [["__scopeId", "data-v-519cca44"]]), ht = /* @__PURE__ */ Y({
212
- __name: "AuthkitSendVerifyCode",
213
- props: {
214
- size: {
215
- type: String,
216
- required: !0
217
- },
218
- loading: {
219
- type: Boolean,
220
- required: !0,
221
- default: () => !1
222
- }
223
- },
224
- emits: ["send"],
225
- setup(i, {
226
- expose: e,
227
- emit: s
228
- }) {
229
- const c = s, u = i, o = _(!1);
230
- let r;
231
- const n = _(0), g = S(() => n.value.toString().padStart(2, "0")), y = S(() => n.value > 0);
232
- function f() {
233
- r && (clearInterval(r), r = void 0);
234
- }
235
- function h() {
236
- if (o.value) {
237
- if (n.value <= 0) {
238
- f(), o.value = !1;
239
- return;
240
- }
241
- n.value--, n.value <= 0 && (f(), o.value = !1);
242
- }
243
- }
244
- function d() {
245
- c("send");
246
- }
247
- function m(I) {
248
- !Number.isFinite(I) || I <= 0 || (n.value = Math.ceil(I), o.value = !0, f(), r = setInterval(h, 1e3));
249
- }
250
- return e({
251
- startCountFn: m
252
- }), ke(() => {
253
- f();
254
- }), (I, E) => (v(), A(t($), {
255
- class: "OAuthItem",
256
- type: "primary",
257
- size: u.size,
258
- disabled: y.value,
259
- loading: u.loading,
260
- onClick: d
261
- }, {
262
- default: l(() => [E[0] || (E[0] = k("span", null, " 发送验证码", -1)), xe(k("span", {
263
- class: "verify-code-timer"
264
- }, T(`(${g.value})`), 513), [[Oe, y.value]])]),
265
- _: 1
266
- }, 8, ["size", "disabled", "loading"]));
267
- }
268
- }), ve = /* @__PURE__ */ Z(ht, [["__scopeId", "data-v-63c6fb3a"]]);
269
- function yt(i) {
270
- if (!i)
271
- return null;
272
- const e = i.match(/请\s*(\d+)\s*秒后再试/);
273
- if (!e)
274
- return null;
275
- const s = Number(e[1]);
276
- return Number.isFinite(s) && s > 0 ? s : null;
277
- }
278
- function _e(i) {
279
- var s, c;
280
- const e = (s = i.data) == null ? void 0 : s.cooldownSeconds;
281
- return typeof e == "number" && e > 0 ? e : yt((c = i.error) == null ? void 0 : c.message);
282
- }
283
- function he(i, e) {
284
- const s = _e(e);
285
- s && i && i.startCountFn(s);
286
- }
287
- const gt = {
288
- class: "sendVerifyCodeItem"
289
- }, wt = {
290
- class: "handle"
291
- }, bt = /* @__PURE__ */ Y({
292
- __name: "AuthkitEmailVerify",
293
- props: {
294
- email: {
295
- type: String,
296
- required: !0,
297
- default: () => ""
298
- },
299
- size: {
300
- type: String,
301
- required: !0
302
- }
303
- },
304
- emits: ["next"],
305
- setup(i, {
306
- emit: e
307
- }) {
308
- const s = e, c = i, u = S(() => Ie(c.email)), o = _(), r = _(!1), n = _(!1), g = _(), y = _({
309
- userToken: void 0,
310
- emailVerifyId: void 0
311
- });
312
- async function f() {
313
- r.value = !0;
314
- const d = await x.verify.email.retry.post({
315
- email: c.email,
316
- purpose: "bindEmail"
317
- });
318
- r.value = !1, d.data && (y.value.emailVerifyId = d.data.emailVerifyId), he(o.value, d);
319
- }
320
- async function h() {
321
- if (!await g.value.validate(["userToken"])) {
322
- n.value = !0;
323
- const {
324
- error: m
325
- } = await x.verify.email.post({
326
- email: c.email,
327
- userToken: y.value.userToken,
328
- emailVerifyId: y.value.emailVerifyId,
329
- purpose: "bindEmail"
330
- });
331
- n.value = !1, m || s("next");
332
- }
333
- }
334
- return (d, m) => (v(), A(t(oe), {
335
- ref_key: "formRef",
336
- ref: g,
337
- model: y.value,
338
- "auto-label-width": "",
339
- size: c.size
340
- }, {
341
- default: l(() => [p(t(L), {
342
- field: "email",
343
- label: "邮箱",
344
- rules: [{
345
- required: !1,
346
- message: "请输入邮箱"
347
- }, {
348
- type: "email",
349
- message: "请输入有效的邮箱"
350
- }]
351
- }, {
352
- default: l(() => [b(T(u.value), 1)]),
353
- _: 1
354
- }), p(t(L), {
355
- field: "userToken",
356
- label: "验证码",
357
- "hide-label": "",
358
- rules: [{
359
- required: !0,
360
- message: "请输入验证码"
361
- }]
362
- }, {
363
- default: l(() => [k("div", gt, [p(t(Q), {
364
- modelValue: y.value.userToken,
365
- "onUpdate:modelValue": m[0] || (m[0] = (I) => y.value.userToken = I),
366
- placeholder: "请输入验证码"
367
- }, null, 8, ["modelValue"]), p(ve, {
368
- ref_key: "SendVerifyCodeRef",
369
- ref: o,
370
- size: c.size,
371
- loading: r.value,
372
- style: {
373
- "margin-left": "10px"
374
- },
375
- onSend: f
376
- }, null, 8, ["size", "loading"])])]),
377
- _: 1
378
- }), p(t(L), {
379
- field: "",
380
- label: "",
381
- rules: []
382
- }, {
383
- default: l(() => [k("div", wt, [p(t($), {
384
- loading: n.value,
385
- type: "primary",
386
- onClick: h
387
- }, {
388
- default: l(() => [...m[1] || (m[1] = [b(" 提交 ", -1)])]),
389
- _: 1
390
- }, 8, ["loading"])])]),
391
- _: 1
392
- })]),
393
- _: 1
394
- }, 8, ["model", "size"]));
395
- }
396
- }), ye = /* @__PURE__ */ Z(bt, [["__scopeId", "data-v-ce312f9d"]]), _t = {
397
- class: "sendVerifyCodeItem"
398
- }, kt = {
399
- class: "handle"
400
- }, zt = /* @__PURE__ */ Y({
401
- __name: "AuthkitPhoneVerify",
402
- props: {
403
- phone: {
404
- type: String,
405
- required: !0
406
- },
407
- size: {
408
- type: String,
409
- required: !0
410
- },
411
- purpose: {
412
- type: String,
413
- default: "bindPhone"
414
- }
415
- },
416
- emits: ["next"],
417
- setup(i, {
418
- emit: e
419
- }) {
420
- const s = e, c = i, u = _(), o = _(!1), r = _(!1), n = _(), g = _({
421
- code: void 0
422
- }), y = S(() => {
423
- const d = c.phone.trim();
424
- return d.length < 7 ? d : `${d.slice(0, 3)}****${d.slice(-4)}`;
425
- });
426
- async function f() {
427
- o.value = !0;
428
- const d = await x.verify.sms.send.post({
429
- phone: c.phone,
430
- purpose: c.purpose
431
- });
432
- o.value = !1, he(u.value, d);
433
- }
434
- async function h() {
435
- if (!await n.value.validate(["code"])) {
436
- r.value = !0;
437
- const {
438
- error: m
439
- } = await x.verify.sms.verify.post({
440
- phone: c.phone,
441
- code: g.value.code,
442
- purpose: c.purpose
443
- });
444
- r.value = !1, m || s("next");
445
- }
446
- }
447
- return (d, m) => (v(), A(t(oe), {
448
- ref_key: "formRef",
449
- ref: n,
450
- model: g.value,
451
- "auto-label-width": "",
452
- size: c.size
453
- }, {
454
- default: l(() => [p(t(L), {
455
- field: "phone",
456
- label: "手机号"
457
- }, {
458
- default: l(() => [b(T(y.value), 1)]),
459
- _: 1
460
- }), p(t(L), {
461
- field: "code",
462
- label: "验证码",
463
- "hide-label": "",
464
- rules: [{
465
- required: !0,
466
- message: "请输入验证码"
467
- }]
468
- }, {
469
- default: l(() => [k("div", _t, [p(t(Q), {
470
- modelValue: g.value.code,
471
- "onUpdate:modelValue": m[0] || (m[0] = (I) => g.value.code = I),
472
- placeholder: "请输入验证码"
473
- }, null, 8, ["modelValue"]), p(ve, {
474
- ref_key: "sendVerifyCodeRef",
475
- ref: u,
476
- size: c.size,
477
- loading: o.value,
478
- style: {
479
- "margin-left": "10px"
480
- },
481
- onSend: f
482
- }, null, 8, ["size", "loading"])])]),
483
- _: 1
484
- }), p(t(L), {
485
- field: "",
486
- label: "",
487
- rules: []
488
- }, {
489
- default: l(() => [k("div", kt, [p(t($), {
490
- loading: r.value,
491
- type: "primary",
492
- onClick: h
493
- }, {
494
- default: l(() => [...m[1] || (m[1] = [b("提交", -1)])]),
495
- _: 1
496
- }, 8, ["loading"])])]),
497
- _: 1
498
- })]),
499
- _: 1
500
- }, 8, ["model", "size"]));
501
- }
502
- }), ge = /* @__PURE__ */ Z(zt, [["__scopeId", "data-v-a10cc2ae"]]), At = {
503
- class: "handle"
504
- }, Pt = /* @__PURE__ */ Y({
505
- __name: "AuthkitPasswordUpdate",
506
- props: {
507
- size: {
508
- type: String,
509
- required: !0
510
- },
511
- requireOldPassword: {
512
- type: Boolean,
513
- default: !0
514
- }
515
- },
516
- emits: ["submit"],
517
- setup(i, {
518
- emit: e
519
- }) {
520
- const s = e, c = _(!1), u = _(), o = i, r = _({
521
- oldPassword: "",
522
- password: "",
523
- confirmPassword: ""
524
- }), n = [{
525
- required: !0,
526
- message: "请输入确认密码"
527
- }, {
528
- minLength: 10,
529
- message: "确认密码不能少于10字符"
530
- }, {
531
- validator: (y, f) => {
532
- y !== r.value.password ? f("两次密码输入不一致,请重新输入") : f();
533
- }
534
- }];
535
- async function g() {
536
- if (!await u.value.validate()) {
537
- c.value = !0;
538
- const f = o.requireOldPassword ? {
539
- password: r.value.password,
540
- oldPassword: r.value.oldPassword
541
- } : {
542
- password: r.value.password
543
- }, {
544
- error: h
545
- } = await x.users.update.password.post(f);
546
- c.value = !1, h || s("submit", f);
547
- }
548
- }
549
- return (y, f) => (v(), A(t(oe), {
550
- ref_key: "formRef",
551
- ref: u,
552
- model: r.value,
553
- "auto-label-width": "",
554
- size: o.size
555
- }, {
556
- default: l(() => [o.requireOldPassword ? (v(), A(t(L), {
557
- key: 0,
558
- field: "oldPassword",
559
- label: "当前密码",
560
- "hide-label": "",
561
- rules: [{
562
- required: !0,
563
- message: "请输入当前密码"
564
- }]
565
- }, {
566
- default: l(() => [p(t(Q), {
567
- modelValue: r.value.oldPassword,
568
- "onUpdate:modelValue": f[0] || (f[0] = (h) => r.value.oldPassword = h),
569
- placeholder: "请输入当前密码",
570
- type: "password"
571
- }, null, 8, ["modelValue"])]),
572
- _: 1
573
- })) : C("", !0), p(t(L), {
574
- field: "password",
575
- label: o.requireOldPassword ? "新密码" : "登录密码",
576
- "hide-label": "",
577
- rules: [{
578
- required: !0,
579
- message: o.requireOldPassword ? "新密码请输入" : "请输入登录密码"
580
- }, {
581
- minLength: 10,
582
- message: "密码不能少于10字符"
583
- }]
584
- }, {
585
- default: l(() => [p(t(Q), {
586
- modelValue: r.value.password,
587
- "onUpdate:modelValue": f[1] || (f[1] = (h) => r.value.password = h),
588
- placeholder: o.requireOldPassword ? "请输入新密码" : "请输入登录密码",
589
- type: "password"
590
- }, null, 8, ["modelValue", "placeholder"])]),
591
- _: 1
592
- }, 8, ["label", "rules"]), p(t(L), {
593
- field: "confirmPassword",
594
- label: "确认密码",
595
- "hide-label": "",
596
- rules: n
597
- }, {
598
- default: l(() => [p(t(Q), {
599
- modelValue: r.value.confirmPassword,
600
- "onUpdate:modelValue": f[2] || (f[2] = (h) => r.value.confirmPassword = h),
601
- placeholder: "请输入确认密码",
602
- type: "password"
603
- }, null, 8, ["modelValue"])]),
604
- _: 1
605
- }), p(t(L), {
606
- field: "",
607
- label: "",
608
- rules: []
609
- }, {
610
- default: l(() => [k("div", At, [p(t($), {
611
- type: "primary",
612
- loading: c.value,
613
- onClick: g
614
- }, {
615
- default: l(() => [...f[3] || (f[3] = [b("提交", -1)])]),
616
- _: 1
617
- }, 8, ["loading"])])]),
618
- _: 1
619
- })]),
620
- _: 1
621
- }, 8, ["model", "size"]));
622
- }
623
- }), Ct = /* @__PURE__ */ Z(Pt, [["__scopeId", "data-v-c69c273d"]]), It = /* @__PURE__ */ Y({
624
- __name: "AuthkitSetPassword",
625
- props: {
626
- size: {
627
- type: String,
628
- required: !0
629
- }
630
- },
631
- setup(i) {
632
- const {
633
- userProfile: e,
634
- fetchUserProfile: s,
635
- isLoggedIn: c
636
- } = ie(), u = _("hidden"), o = i;
637
- function r(y) {
638
- u.value = y;
639
- }
640
- function n(y) {
641
- var f;
642
- J.success((f = e.value) != null && f.hasPassword ? "密码修改成功" : "密码设置成功"), u.value = "hidden", s();
643
- }
644
- function g() {
645
- u.value = "update";
646
- }
647
- return ue(() => {
648
- c.value && !e.value && s();
649
- }), (y, f) => {
650
- var h, d, m, I, E, q, V, P, D;
651
- return v(), M(te, null, [!((h = t(e)) != null && h.email) && !((d = t(e)) != null && d.phone) ? (v(), A(t(G), {
652
- key: 0,
653
- type: "info",
654
- title: "先绑定账号"
655
- }, {
656
- default: l(() => [...f[1] || (f[1] = [b(" 请先绑定邮箱或手机号,再设置登录密码。 ", -1)])]),
657
- _: 1
658
- })) : C("", !0), ((m = t(e)) != null && m.email || (I = t(e)) != null && I.phone) && u.value === "hidden" ? (v(), A(t(G), {
659
- key: 1,
660
- title: (E = t(e)) != null && E.hasPassword ? "更改密码" : "设置登录密码"
661
- }, {
662
- action: l(() => [p(t($), {
663
- size: o.size,
664
- type: "primary",
665
- onClick: f[0] || (f[0] = (U) => r("verify"))
666
- }, {
667
- default: l(() => {
668
- var U;
669
- return [b(T((U = t(e)) != null && U.hasPassword ? "更改密码" : "设置密码"), 1)];
670
- }),
671
- _: 1
672
- }, 8, ["size"])]),
673
- default: l(() => {
674
- var U;
675
- return [b(T((U = t(e)) != null && U.hasPassword ? "为了账户安全,修改密码前会先验证身份。" : "设置登录密码前会先验证身份。") + " ", 1)];
676
- }),
677
- _: 1
678
- }, 8, ["title"])) : C("", !0), u.value === "update" ? (v(), A(Ct, {
679
- key: 2,
680
- size: o.size,
681
- "require-old-password": !!((q = t(e)) != null && q.hasPassword),
682
- onSubmit: n
683
- }, null, 8, ["size", "require-old-password"])) : C("", !0), u.value === "verify" && ((V = t(e)) != null && V.email) ? (v(), A(ye, {
684
- key: 3,
685
- size: o.size,
686
- email: t(e).email,
687
- onNext: g
688
- }, null, 8, ["size", "email"])) : C("", !0), u.value === "verify" && !((P = t(e)) != null && P.email) && ((D = t(e)) != null && D.phone) ? (v(), A(ge, {
689
- key: 4,
690
- size: o.size,
691
- phone: t(e).phone,
692
- onNext: g
693
- }, null, 8, ["size", "phone"])) : C("", !0)], 64);
694
- };
695
- }
696
- }), ce = {
697
- datetime: 180,
698
- name: 240,
699
- /** 单按钮操作列(移除等) */
700
- actionsSingle: 100
701
- };
702
- function ee(i) {
703
- const e = new Uint8Array(i);
704
- let s = "";
705
- for (const u of e)
706
- s += String.fromCharCode(u);
707
- return btoa(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
708
- }
709
- function me(i) {
710
- const e = i.replace(/-/g, "+").replace(/_/g, "/"), s = (4 - e.length % 4) % 4, c = e.padEnd(e.length + s, "="), u = atob(c), o = new ArrayBuffer(u.length), r = new Uint8Array(o);
711
- for (let n = 0; n < u.length; n++)
712
- r[n] = u.charCodeAt(n);
713
- return o;
714
- }
715
- function we() {
716
- return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
717
- }
718
- function Re(i) {
719
- const {
720
- id: e
721
- } = i;
722
- return {
723
- ...i,
724
- id: me(e),
725
- transports: i.transports
726
- };
727
- }
728
- function Se(i) {
729
- return i === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(i);
730
- }
731
- class W extends Error {
732
- constructor({
733
- message: e,
734
- code: s,
735
- cause: c,
736
- name: u
737
- }) {
738
- super(e, {
739
- cause: c
740
- }), this.name = u ?? c.name, this.code = s;
741
- }
742
- }
743
- function Et({
744
- error: i,
745
- options: e
746
- }) {
747
- var c, u, o;
748
- const {
749
- publicKey: s
750
- } = e;
751
- if (!s)
752
- throw Error("options was missing required publicKey property");
753
- if (i.name === "AbortError") {
754
- if (e.signal instanceof AbortSignal)
755
- return new W({
756
- message: "Registration ceremony was sent an abort signal",
757
- code: "ERROR_CEREMONY_ABORTED",
758
- cause: i
759
- });
760
- } else if (i.name === "ConstraintError") {
761
- if (((c = s.authenticatorSelection) == null ? void 0 : c.requireResidentKey) === !0)
762
- return new W({
763
- message: "Discoverable credentials were required but no available authenticator supported it",
764
- code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
765
- cause: i
766
- });
767
- if (e.mediation === "conditional" && ((u = s.authenticatorSelection) == null ? void 0 : u.userVerification) === "required")
768
- return new W({
769
- message: "User verification was required during automatic registration but it could not be performed",
770
- code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
771
- cause: i
772
- });
773
- if (((o = s.authenticatorSelection) == null ? void 0 : o.userVerification) === "required")
774
- return new W({
775
- message: "User verification was required but no available authenticator supported it",
776
- code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
777
- cause: i
778
- });
779
- } else {
780
- if (i.name === "InvalidStateError")
781
- return new W({
782
- message: "The authenticator was previously registered",
783
- code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
784
- cause: i
785
- });
786
- if (i.name === "NotAllowedError")
787
- return new W({
788
- message: i.message,
789
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
790
- cause: i
791
- });
792
- if (i.name === "NotSupportedError")
793
- return s.pubKeyCredParams.filter((n) => n.type === "public-key").length === 0 ? new W({
794
- message: 'No entry in pubKeyCredParams was of type "public-key"',
795
- code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
796
- cause: i
797
- }) : new W({
798
- message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
799
- code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
800
- cause: i
801
- });
802
- if (i.name === "SecurityError") {
803
- const r = window.location.hostname;
804
- if (Se(r)) {
805
- if (s.rp.id !== r)
806
- return new W({
807
- message: `The RP ID "${s.rp.id}" is invalid for this domain`,
808
- code: "ERROR_INVALID_RP_ID",
809
- cause: i
810
- });
811
- } else return new W({
812
- message: `${window.location.hostname} is an invalid domain`,
813
- code: "ERROR_INVALID_DOMAIN",
814
- cause: i
815
- });
816
- } else if (i.name === "TypeError") {
817
- if (s.user.id.byteLength < 1 || s.user.id.byteLength > 64)
818
- return new W({
819
- message: "User ID was not between 1 and 64 characters",
820
- code: "ERROR_INVALID_USER_ID_LENGTH",
821
- cause: i
822
- });
823
- } else if (i.name === "UnknownError")
824
- return new W({
825
- message: "The authenticator was unable to process the specified options, or could not create a new credential",
826
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
827
- cause: i
828
- });
829
- }
830
- return i;
831
- }
832
- class Rt {
833
- createNewAbortSignal() {
834
- if (this.controller) {
835
- const s = new Error("Cancelling existing WebAuthn API call for new one");
836
- s.name = "AbortError", this.controller.abort(s);
837
- }
838
- const e = new AbortController();
839
- return this.controller = e, e.signal;
840
- }
841
- cancelCeremony() {
842
- if (this.controller) {
843
- const e = new Error("Manually cancelling existing WebAuthn API call");
844
- e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
845
- }
846
- }
847
- }
848
- const Ve = new Rt(), St = ["cross-platform", "platform"];
849
- function $e(i) {
850
- if (i && !(St.indexOf(i) < 0))
851
- return i;
852
- }
853
- async function Vt(i) {
854
- var I;
855
- const {
856
- optionsJSON: e,
857
- useAutoRegister: s = !1
858
- } = i;
859
- if (!we())
860
- throw new Error("WebAuthn is not supported in this browser");
861
- const c = {
862
- ...e,
863
- challenge: me(e.challenge),
864
- user: {
865
- ...e.user,
866
- id: me(e.user.id)
867
- },
868
- excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map(Re)
869
- }, u = {};
870
- s && (u.mediation = "conditional"), u.publicKey = c, u.signal = Ve.createNewAbortSignal();
871
- let o;
872
- try {
873
- o = await navigator.credentials.create(u);
874
- } catch (E) {
875
- throw Et({
876
- error: E,
877
- options: u
878
- });
879
- }
880
- if (!o)
881
- throw new Error("Registration was not completed");
882
- const {
883
- id: r,
884
- rawId: n,
885
- response: g,
886
- type: y
887
- } = o;
888
- let f;
889
- typeof g.getTransports == "function" && (f = g.getTransports());
890
- let h;
891
- if (typeof g.getPublicKeyAlgorithm == "function")
892
- try {
893
- h = g.getPublicKeyAlgorithm();
894
- } catch (E) {
895
- be("getPublicKeyAlgorithm()", E);
896
- }
897
- let d;
898
- if (typeof g.getPublicKey == "function")
899
- try {
900
- const E = g.getPublicKey();
901
- E !== null && (d = ee(E));
902
- } catch (E) {
903
- be("getPublicKey()", E);
904
- }
905
- let m;
906
- if (typeof g.getAuthenticatorData == "function")
907
- try {
908
- m = ee(g.getAuthenticatorData());
909
- } catch (E) {
910
- be("getAuthenticatorData()", E);
911
- }
912
- return {
913
- id: r,
914
- rawId: ee(n),
915
- response: {
916
- attestationObject: ee(g.attestationObject),
917
- clientDataJSON: ee(g.clientDataJSON),
918
- transports: f,
919
- publicKeyAlgorithm: h,
920
- publicKey: d,
921
- authenticatorData: m
922
- },
923
- type: y,
924
- clientExtensionResults: o.getClientExtensionResults(),
925
- authenticatorAttachment: $e(o.authenticatorAttachment)
926
- };
927
- }
928
- function be(i, e) {
929
- console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${i}. You should report this error to them.
930
- `, e);
931
- }
932
- function $t() {
933
- if (!we())
934
- return new Promise((e) => e(!1));
935
- const i = window.PublicKeyCredential;
936
- return i.isConditionalMediationAvailable === void 0 ? new Promise((e) => e(!1)) : i.isConditionalMediationAvailable();
937
- }
938
- function Tt({
939
- error: i,
940
- options: e
941
- }) {
942
- const {
943
- publicKey: s
944
- } = e;
945
- if (!s)
946
- throw Error("options was missing required publicKey property");
947
- if (i.name === "AbortError") {
948
- if (e.signal instanceof AbortSignal)
949
- return new W({
950
- message: "Authentication ceremony was sent an abort signal",
951
- code: "ERROR_CEREMONY_ABORTED",
952
- cause: i
953
- });
954
- } else {
955
- if (i.name === "NotAllowedError")
956
- return new W({
957
- message: i.message,
958
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
959
- cause: i
960
- });
961
- if (i.name === "SecurityError") {
962
- const c = window.location.hostname;
963
- if (Se(c)) {
964
- if (s.rpId !== c)
965
- return new W({
966
- message: `The RP ID "${s.rpId}" is invalid for this domain`,
967
- code: "ERROR_INVALID_RP_ID",
968
- cause: i
969
- });
970
- } else return new W({
971
- message: `${window.location.hostname} is an invalid domain`,
972
- code: "ERROR_INVALID_DOMAIN",
973
- cause: i
974
- });
975
- } else if (i.name === "UnknownError")
976
- return new W({
977
- message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
978
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
979
- cause: i
980
- });
981
- }
982
- return i;
983
- }
984
- async function Ut(i) {
985
- var m, I;
986
- const {
987
- optionsJSON: e,
988
- useBrowserAutofill: s = !1,
989
- verifyBrowserAutofillInput: c = !0
990
- } = i;
991
- if (!we())
992
- throw new Error("WebAuthn is not supported in this browser");
993
- let u;
994
- ((m = e.allowCredentials) == null ? void 0 : m.length) !== 0 && (u = (I = e.allowCredentials) == null ? void 0 : I.map(Re));
995
- const o = {
996
- ...e,
997
- challenge: me(e.challenge),
998
- allowCredentials: u
999
- }, r = {};
1000
- if (s) {
1001
- if (!await $t())
1002
- throw Error("Browser does not support WebAuthn autofill");
1003
- if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && c)
1004
- throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
1005
- r.mediation = "conditional", o.allowCredentials = [];
1006
- }
1007
- r.publicKey = o, r.signal = Ve.createNewAbortSignal();
1008
- let n;
1009
- try {
1010
- n = await navigator.credentials.get(r);
1011
- } catch (E) {
1012
- throw Tt({
1013
- error: E,
1014
- options: r
1015
- });
1016
- }
1017
- if (!n)
1018
- throw new Error("Authentication was not completed");
1019
- const {
1020
- id: g,
1021
- rawId: y,
1022
- response: f,
1023
- type: h
1024
- } = n;
1025
- let d;
1026
- return f.userHandle && (d = ee(f.userHandle)), {
1027
- id: g,
1028
- rawId: ee(y),
1029
- response: {
1030
- authenticatorData: ee(f.authenticatorData),
1031
- clientDataJSON: ee(f.clientDataJSON),
1032
- signature: ee(f.signature),
1033
- userHandle: d
1034
- },
1035
- type: h,
1036
- clientExtensionResults: n.getClientExtensionResults(),
1037
- authenticatorAttachment: $e(n.authenticatorAttachment)
1038
- };
1039
- }
1040
- function xt() {
1041
- return ae() === null;
1042
- }
1043
- function ae() {
1044
- return typeof window > "u" ? "非浏览器环境,无法使用 Passkey" : window.isSecureContext ? we() ? null : "当前浏览器不支持 Passkey,请使用 Chrome / Safari / Edge" : "Passkey 需要在安全环境下使用(HTTPS,或 localhost)";
1045
- }
1046
- function Ot(i) {
1047
- return i instanceof Error ? i.name === "NotAllowedError" ? "已取消操作" : i.message.includes("WebAuthn is not supported") ? ae() || "当前环境不支持 Passkey" : i.name === "NotSupportedError" ? "当前设备无可用认证器" : i.message || "Passkey 操作失败" : "Passkey 操作失败";
1048
- }
1049
- function Nt() {
1050
- const i = navigator.userAgent;
1051
- return i.includes("Chrome") ? "Chrome" : i.includes("Safari") ? "Safari" : i.includes("Firefox") ? "Firefox" : i.includes("Edge") ? "Edge" : "Browser";
1052
- }
1053
- function Dt() {
1054
- return `${Nt()} - ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`;
1055
- }
1056
- function qt() {
1057
- const i = _(!1), e = xt();
1058
- async function s(o) {
1059
- const r = ae();
1060
- if (r)
1061
- throw new Error(r);
1062
- i.value = !0;
1063
- try {
1064
- const {
1065
- data: n,
1066
- error: g
1067
- } = await x.passkey.auth.options.post({
1068
- email: (o == null ? void 0 : o.trim()) || void 0
1069
- });
1070
- if (g || !n)
1071
- return null;
1072
- const y = await Ut({
1073
- optionsJSON: n
1074
- }), {
1075
- data: f,
1076
- error: h
1077
- } = await x.passkey.auth.verify.post({
1078
- response: y
1079
- });
1080
- return h || !f ? null : f;
1081
- } finally {
1082
- i.value = !1;
1083
- }
1084
- }
1085
- async function c(o) {
1086
- const r = ae();
1087
- if (r)
1088
- throw new Error(r);
1089
- i.value = !0;
1090
- try {
1091
- const {
1092
- data: n,
1093
- error: g
1094
- } = await x.passkey.register.options.post();
1095
- if (g || !n)
1096
- return !1;
1097
- const y = await Vt({
1098
- optionsJSON: n
1099
- }), {
1100
- error: f
1101
- } = await x.passkey.register.verify.post({
1102
- response: y,
1103
- name: (o == null ? void 0 : o.trim()) || Dt()
1104
- });
1105
- return !f;
1106
- } finally {
1107
- i.value = !1;
1108
- }
1109
- }
1110
- function u(o) {
1111
- return Ot(o);
1112
- }
1113
- return {
1114
- loading: i,
1115
- supported: e,
1116
- loginWithPasskey: s,
1117
- registerPasskey: c,
1118
- formatError: u,
1119
- getPasskeyEnvironmentIssue: ae
1120
- };
1121
- }
1122
- const Bt = {
1123
- class: "passkey-binding"
1124
- }, Lt = {
1125
- key: 0,
1126
- class: "passkey-binding__issue"
1127
- }, Mt = {
1128
- key: 4,
1129
- class: "passkey-binding__toolbar"
1130
- }, Kt = /* @__PURE__ */ Y({
1131
- __name: "AuthkitPasskeyBinding",
1132
- props: {
1133
- size: {
1134
- type: String,
1135
- required: !0
1136
- }
1137
- },
1138
- setup(i) {
1139
- const e = i, {
1140
- userProfile: s
1141
- } = ie(), c = _(!1), u = _(!1), o = _([]), r = ae(), {
1142
- registerPasskey: n,
1143
- formatError: g
1144
- } = qt(), y = _(""), f = _(!1), h = _(), d = S(() => {
1145
- var w, z;
1146
- return !!((w = s.value) != null && w.email || (z = s.value) != null && z.phone);
1147
- }), m = S(() => d.value && !h.value), I = [{
1148
- title: "通行密钥",
1149
- dataIndex: "name",
1150
- minWidth: ce.name,
1151
- ellipsis: !0,
1152
- tooltip: !0
1153
- }, {
1154
- title: "上次使用",
1155
- dataIndex: "lastUsedAt",
1156
- slotName: "lastUsedAt",
1157
- minWidth: ce.datetime,
1158
- ellipsis: !0,
1159
- tooltip: !0
1160
- }, {
1161
- title: "添加时间",
1162
- dataIndex: "createdAt",
1163
- slotName: "createdAt",
1164
- minWidth: ce.datetime,
1165
- ellipsis: !0,
1166
- tooltip: !0
1167
- }, {
1168
- title: "操作",
1169
- slotName: "actions",
1170
- width: ce.actionsSingle,
1171
- fixed: "right",
1172
- cellClassName: "passkey-actions-cell"
1173
- }];
1174
- async function E() {
1175
- c.value = !0;
1176
- const {
1177
- data: w,
1178
- error: z
1179
- } = await x.passkey.list.post();
1180
- if (c.value = !1, z || !w) {
1181
- o.value = [];
1182
- return;
1183
- }
1184
- o.value = w.list;
1185
- }
1186
- async function q() {
1187
- u.value = !0;
1188
- try {
1189
- if (!await n())
1190
- return;
1191
- J.success("Passkey 添加成功"), await E();
1192
- } catch (w) {
1193
- J.error(g(w));
1194
- } finally {
1195
- u.value = !1;
1196
- }
1197
- }
1198
- function V(w) {
1199
- var z, K, F;
1200
- if (y.value = w, f.value = !1, !d.value) {
1201
- j();
1202
- return;
1203
- }
1204
- if ((z = s.value) != null && z.email && ((K = s.value) != null && K.phone)) {
1205
- h.value = void 0;
1206
- return;
1207
- }
1208
- h.value = (F = s.value) != null && F.email ? "email" : "phone";
1209
- }
1210
- function P(w) {
1211
- h.value = w;
1212
- }
1213
- function D() {
1214
- f.value = !0, j();
1215
- }
1216
- function U() {
1217
- y.value = "", f.value = !1, h.value = void 0;
1218
- }
1219
- async function j() {
1220
- if (!y.value)
1221
- return;
1222
- const {
1223
- error: w
1224
- } = await x.passkey.delete.post({
1225
- credentialId: y.value
1226
- });
1227
- w || (J.success("已移除"), await E()), U();
1228
- }
1229
- return ue(() => {
1230
- E();
1231
- }), (w, z) => {
1232
- var K, F;
1233
- return v(), M("div", Bt, [p(t(G), {
1234
- type: "info",
1235
- style: {
1236
- "margin-bottom": "16px"
1237
- }
1238
- }, {
1239
- default: l(() => [...z[2] || (z[2] = [b(" Passkey 使用设备生物识别(指纹 / 面容)登录,绑定后可在登录页一键验证身份。 ", -1)])]),
1240
- _: 1
1241
- }), t(r) ? (v(), M("div", Lt, T(t(r)), 1)) : C("", !0), y.value && !f.value ? (v(), A(t(G), {
1242
- key: 1,
1243
- type: "warning",
1244
- title: "移除前验证身份"
1245
- }, Ne({
1246
- default: l(() => [z[6] || (z[6] = b(" 移除 Passkey 前请先完成身份验证。 ", -1))]),
1247
- _: 2
1248
- }, [m.value ? {
1249
- name: "action",
1250
- fn: l(() => [p(t(pe), null, {
1251
- default: l(() => {
1252
- var B, X;
1253
- return [(B = t(s)) != null && B.email ? (v(), A(t($), {
1254
- key: 0,
1255
- size: e.size,
1256
- type: "primary",
1257
- onClick: z[0] || (z[0] = (ne) => P("email"))
1258
- }, {
1259
- default: l(() => [...z[3] || (z[3] = [b(" 邮箱验证 ", -1)])]),
1260
- _: 1
1261
- }, 8, ["size"])) : C("", !0), (X = t(s)) != null && X.phone ? (v(), A(t($), {
1262
- key: 1,
1263
- size: e.size,
1264
- type: "primary",
1265
- onClick: z[1] || (z[1] = (ne) => P("phone"))
1266
- }, {
1267
- default: l(() => [...z[4] || (z[4] = [b(" 手机验证 ", -1)])]),
1268
- _: 1
1269
- }, 8, ["size"])) : C("", !0), p(t($), {
1270
- size: e.size,
1271
- onClick: U
1272
- }, {
1273
- default: l(() => [...z[5] || (z[5] = [b("取消", -1)])]),
1274
- _: 1
1275
- }, 8, ["size"])];
1276
- }),
1277
- _: 1
1278
- })]),
1279
- key: "0"
1280
- } : void 0]), 1024)) : C("", !0), y.value && h.value === "email" && ((K = t(s)) != null && K.email) ? (v(), A(ye, {
1281
- key: 2,
1282
- size: e.size,
1283
- email: t(s).email,
1284
- onNext: D
1285
- }, null, 8, ["size", "email"])) : C("", !0), y.value && h.value === "phone" && ((F = t(s)) != null && F.phone) ? (v(), A(ge, {
1286
- key: 3,
1287
- size: e.size,
1288
- phone: t(s).phone,
1289
- onNext: D
1290
- }, null, 8, ["size", "phone"])) : C("", !0), y.value ? C("", !0) : (v(), M("div", Mt, [p(t($), {
1291
- type: "primary",
1292
- size: e.size,
1293
- loading: u.value,
1294
- disabled: !!t(r),
1295
- onClick: q
1296
- }, {
1297
- default: l(() => [...z[7] || (z[7] = [b(" 添加 Passkey ", -1)])]),
1298
- _: 1
1299
- }, 8, ["size", "loading", "disabled"])])), y.value ? C("", !0) : (v(), A(Je, {
1300
- key: 5,
1301
- columns: I,
1302
- data: o.value,
1303
- loading: c.value,
1304
- pagination: !1,
1305
- bordered: !1,
1306
- "row-key": "credentialId"
1307
- }, {
1308
- lastUsedAt: l(({
1309
- record: B
1310
- }) => [b(T(B.lastUsedAt || "尚未使用"), 1)]),
1311
- createdAt: l(({
1312
- record: B
1313
- }) => [b(T(B.createdAt || "-"), 1)]),
1314
- actions: l(({
1315
- record: B
1316
- }) => [p(t(Be), {
1317
- content: "确定移除此 Passkey?移除后将无法使用该设备登录",
1318
- onOk: (X) => V(B.credentialId)
1319
- }, {
1320
- default: l(() => [p(t($), {
1321
- type: "text",
1322
- status: "danger",
1323
- size: e.size
1324
- }, {
1325
- default: l(() => [...z[8] || (z[8] = [b("移除", -1)])]),
1326
- _: 1
1327
- }, 8, ["size"])]),
1328
- _: 1
1329
- }, 8, ["onOk"])]),
1330
- _: 1
1331
- }, 8, ["data", "loading"]))]);
1332
- };
1333
- }
1334
- }), Ft = /* @__PURE__ */ Z(Kt, [["__scopeId", "data-v-e1a55313"]]), Ht = {
1335
- class: "BindEmail"
1336
- }, Wt = {
1337
- class: "content"
1338
- }, Gt = {
1339
- class: "sendVerifyCodeItem"
1340
- }, Jt = {
1341
- class: "handle"
1342
- }, Yt = {
1343
- key: 0,
1344
- class: "skip"
1345
- }, jt = /* @__PURE__ */ Y({
1346
- __name: "AuthkitBindEmail",
1347
- props: {
1348
- size: {
1349
- type: String,
1350
- required: !0
1351
- },
1352
- loading: {
1353
- type: Boolean,
1354
- required: !0,
1355
- default: () => !1
1356
- },
1357
- /** 是否显示跳过按钮 */
1358
- showSkip: {
1359
- type: Boolean,
1360
- default: !1
1361
- },
1362
- title: {
1363
- type: String,
1364
- default: "绑定邮箱"
1365
- },
1366
- subtitle: {
1367
- type: String,
1368
- default: "请绑定邮箱以完成账号设置,绑定后可使用邮箱登录"
1369
- },
1370
- submitText: {
1371
- type: String,
1372
- default: "绑定邮箱"
1373
- }
1374
- },
1375
- emits: ["submit", "skip"],
1376
- setup(i, {
1377
- emit: e
1378
- }) {
1379
- const s = e, c = i, u = _(), o = _(!1), r = _(), n = _({
1380
- email: void 0,
1381
- userToken: void 0,
1382
- emailVerifyId: void 0
1383
- });
1384
- async function g() {
1385
- if (!await r.value.validateField(["email"])) {
1386
- o.value = !0;
1387
- const d = await x.verify.email.retry.post({
1388
- email: n.value.email,
1389
- purpose: "bindEmail"
1390
- });
1391
- o.value = !1, d.data && (n.value.emailVerifyId = d.data.emailVerifyId), he(u.value, d);
1392
- }
1393
- }
1394
- async function y() {
1395
- r.value.validate().then((h) => {
1396
- h || s("submit", {
1397
- email: n.value.email,
1398
- userToken: n.value.userToken,
1399
- emailVerifyId: n.value.emailVerifyId
1400
- });
1401
- });
1402
- }
1403
- function f() {
1404
- s("skip");
1405
- }
1406
- return (h, d) => (v(), M("div", Ht, [p(t(G), {
1407
- type: "info",
1408
- title: c.title
1409
- }, {
1410
- default: l(() => [b(T(c.subtitle), 1)]),
1411
- _: 1
1412
- }, 8, ["title"]), k("div", Wt, [p(t(oe), {
1413
- ref_key: "formRef",
1414
- ref: r,
1415
- model: n.value,
1416
- size: c.size,
1417
- "auto-label-width": ""
1418
- }, {
1419
- default: l(() => [p(t(L), {
1420
- field: "email",
1421
- label: "邮箱",
1422
- "hide-label": "",
1423
- rules: [{
1424
- required: !0,
1425
- message: "请输入邮箱"
1426
- }, {
1427
- type: "email",
1428
- message: "请输入有效的邮箱"
1429
- }]
1430
- }, {
1431
- default: l(() => [p(t(Q), {
1432
- modelValue: n.value.email,
1433
- "onUpdate:modelValue": d[0] || (d[0] = (m) => n.value.email = m),
1434
- placeholder: "请输入邮箱",
1435
- autocomplete: "email",
1436
- type: "email"
1437
- }, null, 8, ["modelValue"])]),
1438
- _: 1
1439
- }), p(t(L), {
1440
- field: "userToken",
1441
- label: "验证码",
1442
- "hide-label": "",
1443
- rules: [{
1444
- required: !0,
1445
- message: "请输入验证码"
1446
- }]
1447
- }, {
1448
- default: l(() => [k("div", Gt, [p(t(Q), {
1449
- modelValue: n.value.userToken,
1450
- "onUpdate:modelValue": d[1] || (d[1] = (m) => n.value.userToken = m),
1451
- placeholder: "请输入验证码",
1452
- autocomplete: "one-time-code"
1453
- }, null, 8, ["modelValue"]), p(ve, {
1454
- ref_key: "SendVerifyCodeRef",
1455
- ref: u,
1456
- size: c.size,
1457
- loading: o.value,
1458
- style: {
1459
- "margin-left": "10px"
1460
- },
1461
- onSend: g
1462
- }, null, 8, ["size", "loading"])])]),
1463
- _: 1
1464
- }), k("div", Jt, [p(t($), {
1465
- type: "primary",
1466
- loading: c.loading,
1467
- long: "",
1468
- size: c.size,
1469
- onClick: y
1470
- }, {
1471
- default: l(() => [b(T(c.submitText), 1)]),
1472
- _: 1
1473
- }, 8, ["loading", "size"])])]),
1474
- _: 1
1475
- }, 8, ["model", "size"])]), c.showSkip ? (v(), M("div", Yt, [p(t(Ce), {
1476
- onClick: f
1477
- }, {
1478
- default: l(() => [...d[2] || (d[2] = [b("稍后绑定", -1)])]),
1479
- _: 1
1480
- })])) : C("", !0)]));
1481
- }
1482
- }), Qt = /* @__PURE__ */ Z(jt, [["__scopeId", "data-v-faefcd77"]]), Xt = /* @__PURE__ */ Y({
1483
- __name: "AuthkitEmailBinding",
1484
- props: {
1485
- size: {
1486
- type: String,
1487
- required: !0
1488
- }
1489
- },
1490
- setup(i) {
1491
- const {
1492
- userProfile: e,
1493
- loading: s,
1494
- fetchUserProfile: c
1495
- } = ie(), u = _("hidden"), o = _(!1), r = i, n = S(() => {
1496
- var h;
1497
- return !!((h = e.value) != null && h.email) && o.value;
1498
- });
1499
- function g(h) {
1500
- u.value = h;
1501
- }
1502
- async function y(h) {
1503
- s.value = !0;
1504
- const d = n.value ? x.users.update.myEmail.post({
1505
- email: h.email,
1506
- userToken: h.userToken,
1507
- emailVerifyId: h.emailVerifyId
1508
- }) : x.auth.bind.email.post({
1509
- email: h.email,
1510
- userToken: h.userToken,
1511
- emailVerifyId: h.emailVerifyId
1512
- }), {
1513
- error: m
1514
- } = await d;
1515
- s.value = !1, m || (J.success(n.value ? "更改成功" : "绑定成功"), u.value = "hidden", o.value = !1, c());
1516
- }
1517
- function f() {
1518
- o.value = !0, u.value = "update";
1519
- }
1520
- return ue(() => {
1521
- e.value || c();
1522
- }), (h, d) => {
1523
- var m, I, E;
1524
- return v(), M(te, null, [(m = t(e)) != null && m.email && u.value === "hidden" ? (v(), A(t(G), {
1525
- key: 0,
1526
- title: "更改邮箱"
1527
- }, {
1528
- action: l(() => [p(t($), {
1529
- size: r.size,
1530
- type: "primary",
1531
- onClick: d[0] || (d[0] = (q) => g("verify"))
1532
- }, {
1533
- default: l(() => [...d[1] || (d[1] = [b("更改邮箱", -1)])]),
1534
- _: 1
1535
- }, 8, ["size"])]),
1536
- default: l(() => [b(T(`您绑定的邮箱为 ${t(Ie)(t(e).email)}`) + " ", 1)]),
1537
- _: 1
1538
- })) : C("", !0), !((I = t(e)) != null && I.email) || u.value === "update" ? (v(), A(Qt, {
1539
- key: 1,
1540
- loading: t(s),
1541
- size: r.size,
1542
- title: n.value ? "更改邮箱" : "绑定邮箱",
1543
- subtitle: n.value ? "请输入新的邮箱并完成验证" : "请绑定邮箱以完成账号设置,绑定后可使用邮箱登录",
1544
- "submit-text": n.value ? "更改邮箱" : "绑定邮箱",
1545
- onSubmit: y
1546
- }, null, 8, ["loading", "size", "title", "subtitle", "submit-text"])) : C("", !0), u.value === "verify" ? (v(), A(ye, {
1547
- key: 2,
1548
- size: r.size,
1549
- email: (E = t(e)) == null ? void 0 : E.email,
1550
- onNext: f
1551
- }, null, 8, ["size", "email"])) : C("", !0)], 64);
1552
- };
1553
- }
1554
- }), Zt = {
1555
- class: "BindPhone"
1556
- }, ei = {
1557
- class: "header"
1558
- }, ti = {
1559
- class: "title"
1560
- }, ii = {
1561
- class: "subtitle"
1562
- }, ni = {
1563
- class: "content"
1564
- }, ai = {
1565
- class: "sendVerifyCodeItem"
1566
- }, oi = {
1567
- class: "handle"
1568
- }, si = {
1569
- key: 0,
1570
- class: "skip"
1571
- }, li = /* @__PURE__ */ Y({
1572
- __name: "AuthkitBindPhone",
1573
- props: {
1574
- size: {
1575
- type: String,
1576
- required: !0
1577
- },
1578
- loading: {
1579
- type: Boolean,
1580
- required: !0,
1581
- default: () => !1
1582
- },
1583
- showSkip: {
1584
- type: Boolean,
1585
- default: !1
1586
- },
1587
- title: {
1588
- type: String,
1589
- default: "绑定手机号"
1590
- },
1591
- subtitle: {
1592
- type: String,
1593
- default: "请绑定手机号以完成账号设置"
1594
- },
1595
- submitText: {
1596
- type: String,
1597
- default: "绑定手机号"
1598
- }
1599
- },
1600
- emits: ["submit", "skip"],
1601
- setup(i, {
1602
- emit: e
1603
- }) {
1604
- const s = e, c = i, u = _(), o = _(!1), r = _(), n = _({
1605
- phone: void 0,
1606
- code: void 0
1607
- });
1608
- async function g() {
1609
- if (!await r.value.validateField(["phone"])) {
1610
- o.value = !0;
1611
- const d = await x.verify.sms.send.post({
1612
- phone: n.value.phone,
1613
- purpose: "bindPhone"
1614
- });
1615
- o.value = !1, he(u.value, d);
1616
- }
1617
- }
1618
- async function y() {
1619
- r.value.validate().then((h) => {
1620
- h || s("submit", {
1621
- phone: n.value.phone,
1622
- code: n.value.code
1623
- });
1624
- });
1625
- }
1626
- function f() {
1627
- s("skip");
1628
- }
1629
- return (h, d) => (v(), M("div", Zt, [k("div", ei, [k("h3", ti, T(c.title), 1), k("p", ii, T(c.subtitle), 1)]), k("div", ni, [p(t(oe), {
1630
- ref_key: "formRef",
1631
- ref: r,
1632
- model: n.value,
1633
- size: c.size,
1634
- "auto-label-width": ""
1635
- }, {
1636
- default: l(() => [p(t(L), {
1637
- field: "phone",
1638
- label: "手机号",
1639
- "hide-label": "",
1640
- rules: [{
1641
- required: !0,
1642
- message: "请输入手机号"
1643
- }, {
1644
- match: /^1[3-9]\d{9}$/,
1645
- message: "请输入有效的手机号"
1646
- }]
1647
- }, {
1648
- default: l(() => [p(t(Q), {
1649
- modelValue: n.value.phone,
1650
- "onUpdate:modelValue": d[0] || (d[0] = (m) => n.value.phone = m),
1651
- placeholder: "请输入手机号",
1652
- autocomplete: "tel",
1653
- type: "tel"
1654
- }, null, 8, ["modelValue"])]),
1655
- _: 1
1656
- }), p(t(L), {
1657
- field: "code",
1658
- label: "验证码",
1659
- "hide-label": "",
1660
- rules: [{
1661
- required: !0,
1662
- message: "请输入验证码"
1663
- }]
1664
- }, {
1665
- default: l(() => [k("div", ai, [p(t(Q), {
1666
- modelValue: n.value.code,
1667
- "onUpdate:modelValue": d[1] || (d[1] = (m) => n.value.code = m),
1668
- placeholder: "请输入验证码",
1669
- autocomplete: "one-time-code"
1670
- }, null, 8, ["modelValue"]), p(ve, {
1671
- ref_key: "SendVerifyCodeRef",
1672
- ref: u,
1673
- size: c.size,
1674
- loading: o.value,
1675
- style: {
1676
- "margin-left": "10px"
1677
- },
1678
- onSend: g
1679
- }, null, 8, ["size", "loading"])])]),
1680
- _: 1
1681
- }), k("div", oi, [p(t($), {
1682
- type: "primary",
1683
- loading: c.loading,
1684
- long: "",
1685
- size: c.size,
1686
- onClick: y
1687
- }, {
1688
- default: l(() => [b(T(c.submitText), 1)]),
1689
- _: 1
1690
- }, 8, ["loading", "size"])])]),
1691
- _: 1
1692
- }, 8, ["model", "size"])]), c.showSkip ? (v(), M("div", si, [p(t(Ce), {
1693
- onClick: f
1694
- }, {
1695
- default: l(() => [...d[2] || (d[2] = [b("稍后绑定", -1)])]),
1696
- _: 1
1697
- })])) : C("", !0)]));
1698
- }
1699
- }), ri = /* @__PURE__ */ Z(li, [["__scopeId", "data-v-cdae5a8d"]]), ui = /* @__PURE__ */ Y({
1700
- __name: "AuthkitPhoneBinding",
1701
- props: {
1702
- size: {
1703
- type: String,
1704
- required: !0
1705
- }
1706
- },
1707
- setup(i) {
1708
- const {
1709
- userProfile: e,
1710
- loading: s,
1711
- fetchUserProfile: c
1712
- } = ie(), u = _("hidden"), o = _(!1), r = i, n = S(() => {
1713
- var m;
1714
- const d = ((m = e.value) == null ? void 0 : m.phone) || "";
1715
- return d.length < 7 ? d : `${d.slice(0, 3)}****${d.slice(-4)}`;
1716
- }), g = S(() => {
1717
- var d;
1718
- return !!((d = e.value) != null && d.phone) && o.value;
1719
- });
1720
- function y(d) {
1721
- var m;
1722
- u.value = d, d === "update" && !((m = e.value) != null && m.phone) && (o.value = !1);
1723
- }
1724
- async function f(d) {
1725
- s.value = !0;
1726
- const m = g.value ? x.users.update.myPhone.post({
1727
- phone: d.phone,
1728
- code: d.code
1729
- }) : x.auth.bind.phone.post({
1730
- phone: d.phone,
1731
- code: d.code
1732
- }), {
1733
- error: I
1734
- } = await m;
1735
- s.value = !1, I || (J.success(g.value ? "更改成功" : "绑定成功"), u.value = "hidden", o.value = !1, c());
1736
- }
1737
- function h() {
1738
- o.value = !0, u.value = "update";
1739
- }
1740
- return ue(() => {
1741
- e.value || c();
1742
- }), (d, m) => {
1743
- var I, E, q;
1744
- return v(), M(te, null, [!((I = t(e)) != null && I.phone) && u.value === "hidden" ? (v(), A(t(G), {
1745
- key: 0,
1746
- title: "绑定手机号"
1747
- }, {
1748
- action: l(() => [p(t($), {
1749
- size: r.size,
1750
- type: "primary",
1751
- onClick: m[0] || (m[0] = (V) => y("update"))
1752
- }, {
1753
- default: l(() => [...m[2] || (m[2] = [b("绑定手机号", -1)])]),
1754
- _: 1
1755
- }, 8, ["size"])]),
1756
- default: l(() => [m[3] || (m[3] = b(" 您还未绑定手机号,请点击绑定手机号。 ", -1))]),
1757
- _: 1
1758
- })) : C("", !0), (E = t(e)) != null && E.phone && u.value === "hidden" ? (v(), A(t(G), {
1759
- key: 1,
1760
- title: "已绑定手机号"
1761
- }, {
1762
- action: l(() => [p(t($), {
1763
- size: r.size,
1764
- type: "primary",
1765
- onClick: m[1] || (m[1] = (V) => y("verify"))
1766
- }, {
1767
- default: l(() => [...m[4] || (m[4] = [b("更改手机号", -1)])]),
1768
- _: 1
1769
- }, 8, ["size"])]),
1770
- default: l(() => [b(T(`您绑定的手机号为 ${n.value}`) + " ", 1)]),
1771
- _: 1
1772
- })) : C("", !0), u.value === "update" ? (v(), A(ri, {
1773
- key: 2,
1774
- loading: t(s),
1775
- size: r.size,
1776
- title: g.value ? "更改手机号" : "绑定手机号",
1777
- subtitle: g.value ? "请输入新的手机号并完成短信验证" : "请绑定手机号以完成账号设置",
1778
- "submit-text": g.value ? "更改手机号" : "绑定手机号",
1779
- onSubmit: f
1780
- }, null, 8, ["loading", "size", "title", "subtitle", "submit-text"])) : C("", !0), u.value === "verify" ? (v(), A(ge, {
1781
- key: 3,
1782
- size: r.size,
1783
- phone: ((q = t(e)) == null ? void 0 : q.phone) || "",
1784
- onNext: h
1785
- }, null, 8, ["size", "phone"])) : C("", !0)], 64);
1786
- };
1787
- }
1788
- });
1789
- function di() {
1790
- var e;
1791
- return typeof window > "u" ? "" : ((e = new URLSearchParams(window.location.search).get("inviteCode")) == null ? void 0 : e.trim()) || "";
1792
- }
1793
- function Te() {
1794
- return re.oauthCallbackUrl ? re.oauthCallbackUrl : `${window.location.origin}/`;
1795
- }
1796
- function ci() {
1797
- const i = window.location.pathname + window.location.search + window.location.hash, e = new URLSearchParams(window.location.search);
1798
- !e.has("token") && !e.has("error") && !e.has("bindSuccess") && sessionStorage.setItem("auth_redirect", i);
1799
- }
1800
- async function de(i, e) {
1801
- const s = re.appId;
1802
- if (!s) {
1803
- console.error(`${i} OAuth 失败: appId 未配置`);
1804
- return;
1805
- }
1806
- const c = Te(), u = (e == null ? void 0 : e.inviteCode) || di() || void 0, o = {
1807
- appId: s,
1808
- inviteCode: u,
1809
- redirectUri: c,
1810
- acceptedTerms: (e == null ? void 0 : e.acceptedTerms) === !0 ? !0 : void 0
1811
- };
1812
- ci();
1813
- const r = {
1814
- github: () => x.oauth.github.login.get(o),
1815
- google: () => x.oauth.google.login.get(o),
1816
- microsoft: () => x.oauth.microsoft.login.get(o),
1817
- wechat: () => x.oauth.wechat.login.get(o)
1818
- };
1819
- try {
1820
- const {
1821
- data: n
1822
- } = await r[i]();
1823
- n != null && n.redirectUri ? window.location.href = n.redirectUri : console.error(`${i} OAuth 重定向URL为空`);
1824
- } catch (n) {
1825
- console.error(`${i} OAuth 授权失败:`, n);
1826
- }
1827
- }
1828
- function fi(i) {
1829
- de("github", i);
1830
- }
1831
- function pi(i) {
1832
- de("google", i);
1833
- }
1834
- function mi(i) {
1835
- de("microsoft", i);
1836
- }
1837
- function vi(i) {
1838
- de("wechat", i);
1839
- }
1840
- function hi() {
1841
- return {
1842
- githubAuth: fi,
1843
- googleAuth: pi,
1844
- microsoftAuth: mi,
1845
- wechatAuth: vi,
1846
- startOauth: de,
1847
- getOauthCallbackUrl: Te
1848
- };
1849
- }
1850
- const yi = ["src", "alt", "width", "height"], gi = /* @__PURE__ */ Y({
1851
- __name: "AuthProviderIcon",
1852
- props: {
1853
- icon: {},
1854
- size: {
1855
- default: 24
1856
- },
1857
- alt: {
1858
- default: ""
1859
- },
1860
- class: {
1861
- default: ""
1862
- }
1863
- },
1864
- setup(i) {
1865
- const e = i;
1866
- return (s, c) => t(je)(e.icon) ? (v(), A(t(Ye), {
1867
- key: 0,
1868
- icon: e.icon,
1869
- width: e.size,
1870
- height: e.size,
1871
- class: ze(e.class)
1872
- }, null, 8, ["icon", "width", "height", "class"])) : e.icon ? (v(), M("img", {
1873
- key: 1,
1874
- src: e.icon,
1875
- alt: e.alt,
1876
- width: e.size,
1877
- height: e.size,
1878
- class: ze(["auth-provider-icon__image", e.class])
1879
- }, null, 10, yi)) : C("", !0);
1880
- }
1881
- }), wi = /* @__PURE__ */ Z(gi, [["__scopeId", "data-v-1d09c1ef"]]), le = {
1882
- github: "selfhst:github",
1883
- google: "selfhst:google",
1884
- microsoft: "selfhst:microsoft",
1885
- wechat: "selfhst:wechat"
1886
- }, bi = "selfhst:ksuite-kpaste", _i = 32, ki = 2, cn = _i + ki * 2, fn = 12, zi = 24, fe = {
1887
- github: "GitHub",
1888
- google: "Google",
1889
- microsoft: "Microsoft",
1890
- wechat: "微信"
1891
- }, Ai = {
1892
- class: "oauth-binding-account"
1893
- }, Pi = {
1894
- key: 1,
1895
- class: "oauth-binding-account__icon"
1896
- }, Ci = {
1897
- class: "oauth-binding-account__info"
1898
- }, Ii = {
1899
- class: "oauth-binding-account__provider"
1900
- }, Ei = {
1901
- class: "oauth-binding-account__name"
1902
- }, Ri = {
1903
- class: "oauth-binding-verify-actions"
1904
- }, Si = /* @__PURE__ */ Y({
1905
- __name: "AuthkitOAuthBinding",
1906
- props: {
1907
- provider: {
1908
- type: String,
1909
- required: !0
1910
- },
1911
- label: {
1912
- type: String,
1913
- required: !0
1914
- },
1915
- size: {
1916
- type: String,
1917
- required: !0
1918
- }
1919
- },
1920
- setup(i) {
1921
- const e = i, {
1922
- userProfile: s,
1923
- fetchUserProfile: c
1924
- } = ie(), {
1925
- appsData: u
1926
- } = Ee(), {
1927
- getOauthCallbackUrl: o
1928
- } = hi(), r = _("hidden"), n = _(), g = _(!1);
1929
- let y;
1930
- const f = S(() => {
1931
- var a;
1932
- return ((a = s.value) == null ? void 0 : a[e.provider]) || null;
1933
- }), h = S(() => {
1934
- const a = f.value;
1935
- return a ? a.login || a.name || a.nickname || a.displayName || a.userPrincipalName || a.email || a.mail || a.openid || e.label : "";
1936
- }), d = S(() => {
1937
- const a = f.value;
1938
- return (a == null ? void 0 : a.avatar_url) || (a == null ? void 0 : a.picture) || (a == null ? void 0 : a.headimgurl) || "";
1939
- }), m = S(() => le[e.provider]), I = S(() => {
1940
- const a = u.value.authMethods;
1941
- return a.signUp.email || a.login.emailPassword || a.login.emailCode;
1942
- }), E = S(() => {
1943
- const a = u.value.authMethods;
1944
- return a.signUp.phone || a.login.phonePassword || a.login.phoneCode;
1945
- }), q = S(() => {
1946
- var a;
1947
- return I.value && !!((a = s.value) != null && a.email);
1948
- }), V = S(() => {
1949
- var a;
1950
- return E.value && !!((a = s.value) != null && a.phone);
1951
- }), P = S(() => {
1952
- const a = [];
1953
- return q.value && a.push("email"), V.value && a.push("phone"), a;
1954
- }), D = S(() => I.value || E.value), U = S(() => r.value !== "hidden" && P.value.length > 1 && !n.value), j = S(() => {
1955
- var a;
1956
- return r.value !== "hidden" && n.value === "email" && !!((a = s.value) != null && a.email);
1957
- }), w = S(() => {
1958
- var a;
1959
- return r.value !== "hidden" && n.value === "phone" && !!((a = s.value) != null && a.phone);
1960
- }), z = S(() => r.value === "unbind" ? "解绑" : "绑定");
1961
- function K(a) {
1962
- if (a === "hidden") {
1963
- r.value = a, n.value = void 0;
1964
- return;
1965
- }
1966
- if (!D.value) {
1967
- a === "bind" && B(), a === "unbind" && X();
1968
- return;
1969
- }
1970
- const R = P.value;
1971
- if (R.length === 0) {
1972
- J.error("请先绑定应用已开启的邮箱或手机号后再操作第三方账号");
1973
- return;
1974
- }
1975
- r.value = a, n.value = R.length === 1 ? R[0] : void 0;
1976
- }
1977
- function F(a) {
1978
- n.value = a;
1979
- }
1980
- async function B() {
1981
- const a = re.appId;
1982
- if (!a) {
1983
- console.error(`${e.label} OAuth 失败: appId 未配置`);
1984
- return;
1985
- }
1986
- const R = o(), N = {
1987
- github: () => x.oauth.github.login.get({
1988
- appId: a,
1989
- mode: "bind",
1990
- redirectUri: R
1991
- }),
1992
- google: () => x.oauth.google.login.get({
1993
- appId: a,
1994
- mode: "bind",
1995
- redirectUri: R
1996
- }),
1997
- microsoft: () => x.oauth.microsoft.login.get({
1998
- appId: a,
1999
- mode: "bind",
2000
- redirectUri: R
2001
- }),
2002
- wechat: () => x.oauth.wechat.login.get({
2003
- appId: a,
2004
- mode: "bind",
2005
- redirectUri: R
2006
- })
2007
- }, {
2008
- data: H
2009
- } = await N[e.provider]();
2010
- H != null && H.redirectUri && (g.value = !0, window.open(H.redirectUri, "_blank"));
2011
- }
2012
- async function X() {
2013
- const {
2014
- error: a
2015
- } = await x.users.unbind.oauth.post({
2016
- provider: e.provider
2017
- });
2018
- a || (J.success("解绑成功"), r.value = "hidden", c());
2019
- }
2020
- function ne() {
2021
- r.value === "bind" && (r.value = "hidden", B()), r.value === "unbind" && X();
2022
- }
2023
- function O() {
2024
- g.value && c();
2025
- }
2026
- return ue(() => {
2027
- s.value || c(), y = setInterval(O, 1e3);
2028
- }), ke(() => {
2029
- y && clearInterval(y);
2030
- }), (a, R) => {
2031
- var N, H;
2032
- return v(), M(te, null, [!f.value && r.value === "hidden" ? (v(), A(t(G), {
2033
- key: 0,
2034
- title: `绑定${e.label}`
2035
- }, {
2036
- action: l(() => [p(t($), {
2037
- size: e.size,
2038
- type: "primary",
2039
- onClick: R[0] || (R[0] = (se) => K("bind"))
2040
- }, {
2041
- default: l(() => [b(" 绑定" + T(e.label), 1)]),
2042
- _: 1
2043
- }, 8, ["size"])]),
2044
- default: l(() => [b(" 您还未绑定" + T(e.label) + "账号,请点击绑定。 ", 1)]),
2045
- _: 1
2046
- }, 8, ["title"])) : C("", !0), f.value && r.value === "hidden" ? (v(), A(t(G), {
2047
- key: 1,
2048
- title: `解绑${e.label}`
2049
- }, {
2050
- action: l(() => [p(t($), {
2051
- size: e.size,
2052
- type: "primary",
2053
- onClick: R[1] || (R[1] = (se) => K("unbind"))
2054
- }, {
2055
- default: l(() => [b(" 解绑" + T(e.label), 1)]),
2056
- _: 1
2057
- }, 8, ["size"])]),
2058
- default: l(() => [k("div", Ai, [d.value ? (v(), A(t(Pe), {
2059
- key: 0,
2060
- class: "oauth-binding-account__avatar",
2061
- "image-url": d.value,
2062
- size: 42
2063
- }, null, 8, ["image-url"])) : (v(), M("div", Pi, [p(wi, {
2064
- icon: m.value,
2065
- size: t(zi),
2066
- alt: e.label
2067
- }, null, 8, ["icon", "size", "alt"])])), k("div", Ci, [k("div", Ii, T(e.label), 1), k("div", Ei, T(h.value), 1)])])]),
2068
- _: 1
2069
- }, 8, ["title"])) : C("", !0), U.value ? (v(), A(t(G), {
2070
- key: 2,
2071
- title: `${z.value}前验证身份`
2072
- }, {
2073
- action: l(() => [k("div", Ri, [q.value ? (v(), A(t($), {
2074
- key: 0,
2075
- size: e.size,
2076
- type: "primary",
2077
- onClick: R[2] || (R[2] = (se) => F("email"))
2078
- }, {
2079
- default: l(() => [...R[4] || (R[4] = [b(" 邮箱验证 ", -1)])]),
2080
- _: 1
2081
- }, 8, ["size"])) : C("", !0), V.value ? (v(), A(t($), {
2082
- key: 1,
2083
- size: e.size,
2084
- type: "primary",
2085
- onClick: R[3] || (R[3] = (se) => F("phone"))
2086
- }, {
2087
- default: l(() => [...R[5] || (R[5] = [b(" 手机验证 ", -1)])]),
2088
- _: 1
2089
- }, 8, ["size"])) : C("", !0)])]),
2090
- default: l(() => [R[6] || (R[6] = b(" 请选择一种已绑定的验证方式。 ", -1))]),
2091
- _: 1
2092
- }, 8, ["title"])) : C("", !0), j.value ? (v(), A(ye, {
2093
- key: 3,
2094
- size: e.size,
2095
- email: (N = t(s)) == null ? void 0 : N.email,
2096
- onNext: ne
2097
- }, null, 8, ["size", "email"])) : C("", !0), w.value ? (v(), A(ge, {
2098
- key: 4,
2099
- size: e.size,
2100
- phone: ((H = t(s)) == null ? void 0 : H.phone) || "",
2101
- onNext: ne
2102
- }, null, 8, ["size", "phone"])) : C("", !0)], 64);
2103
- };
2104
- }
2105
- }), Vi = /* @__PURE__ */ Z(Si, [["__scopeId", "data-v-bd69efb3"]]), $i = {
2106
- class: "dependency-list"
2107
- }, Ti = {
2108
- class: "label"
2109
- }, Ui = {
2110
- class: "count"
2111
- }, xi = {
2112
- class: "action-bar"
2113
- }, Oi = {
2114
- class: "verify-code-row"
2115
- }, Ni = {
2116
- class: "verify-code-row"
2117
- }, Di = /* @__PURE__ */ Y({
2118
- __name: "AuthkitAccountDelete",
2119
- props: {
2120
- size: {
2121
- type: String,
2122
- required: !0
2123
- }
2124
- },
2125
- emits: ["deleted"],
2126
- setup(i, {
2127
- emit: e
2128
- }) {
2129
- const s = i, c = e, {
2130
- userProfile: u,
2131
- clearUserProfile: o
2132
- } = ie(), {
2133
- clearAuth: r
2134
- } = Xe(), n = _("check"), g = _(!1), y = _([]), f = _(!1), h = _(""), d = _(0);
2135
- let m = null;
2136
- const I = _("email"), E = S(() => {
2137
- var N;
2138
- const O = ((N = u.value) == null ? void 0 : N.email) || "";
2139
- if (!O) return "";
2140
- const [a, R] = O.split("@");
2141
- return a.length <= 2 ? O : `${a.slice(0, 2)}***@${R}`;
2142
- }), q = S(() => {
2143
- var a;
2144
- const O = ((a = u.value) == null ? void 0 : a.phone) || "";
2145
- return O.length < 7 ? O : `${O.slice(0, 3)}****${O.slice(-4)}`;
2146
- }), V = S(() => I.value === "email" ? `为确保账号安全,我们将向您的邮箱 ${E.value} 发送验证码` : `为确保账号安全,我们将向您的手机号 ${q.value} 发送验证码`), P = S(() => I.value === "email" ? `验证码已发送至 ${E.value},注销后该账号将无法继续登录,请谨慎操作` : `验证码已发送至 ${q.value},注销后该账号将无法继续登录,请谨慎操作`), D = _(), U = _({
2147
- userToken: "",
2148
- code: "",
2149
- password: "",
2150
- confirmText: ""
2151
- }), j = _(!1);
2152
- function w(O, a) {
2153
- O !== "注销" ? a('请输入"注销"以确认操作') : a();
2154
- }
2155
- async function z() {
2156
- var O, a;
2157
- if (g.value = !0, g.value = !1, !((O = u.value) != null && O.email) && !((a = u.value) != null && a.phone)) {
2158
- J.error("请先绑定邮箱或手机号后再注销账号");
2159
- return;
2160
- }
2161
- if (u.value.email && u.value.phone) {
2162
- n.value = "chooseMethod";
2163
- return;
2164
- }
2165
- I.value = u.value.email ? "email" : "phone", n.value = "sendCode";
2166
- }
2167
- function K(O) {
2168
- I.value = O, n.value = "sendCode";
2169
- }
2170
- async function F() {
2171
- var R, N;
2172
- if (I.value === "email") {
2173
- if (!((R = u.value) != null && R.email)) {
2174
- J.error("请先绑定邮箱");
2175
- return;
2176
- }
2177
- f.value = !0;
2178
- const H = await x.verify.email.retry.post({
2179
- email: u.value.email,
2180
- purpose: "deleteAccount"
2181
- });
2182
- f.value = !1;
2183
- const se = _e(H);
2184
- H.data && (h.value = H.data.emailVerifyId, J.success("验证码已发送"), n.value = "confirm"), B(se);
2185
- return;
2186
- }
2187
- if (!((N = u.value) != null && N.phone)) {
2188
- J.error("请先绑定手机号");
2189
- return;
2190
- }
2191
- f.value = !0;
2192
- const O = await x.verify.sms.send.post({
2193
- phone: u.value.phone,
2194
- purpose: "deleteAccount"
2195
- });
2196
- f.value = !1;
2197
- const a = _e(O);
2198
- O.error || (J.success("验证码已发送"), n.value = "confirm"), B(a);
2199
- }
2200
- function B(O) {
2201
- !O || O <= 0 || (d.value = Math.ceil(O), m && clearInterval(m), m = setInterval(() => {
2202
- d.value--, d.value <= 0 && m && (clearInterval(m), m = null);
2203
- }, 1e3));
2204
- }
2205
- ke(() => {
2206
- m && (clearInterval(m), m = null);
2207
- });
2208
- async function X() {
2209
- var N, H;
2210
- if (await ((N = D.value) == null ? void 0 : N.validate())) return;
2211
- j.value = !0;
2212
- const a = I.value === "email" ? {
2213
- method: "email",
2214
- userToken: U.value.userToken,
2215
- emailVerifyId: h.value,
2216
- password: U.value.password || void 0,
2217
- confirmText: U.value.confirmText
2218
- } : {
2219
- method: "phone",
2220
- phone: (H = u.value) == null ? void 0 : H.phone,
2221
- code: U.value.code,
2222
- password: U.value.password || void 0,
2223
- confirmText: U.value.confirmText
2224
- }, {
2225
- error: R
2226
- } = await x.users.deleteAccount.post(a);
2227
- j.value = !1, R || (n.value = "success", o(), r(), c("deleted"));
2228
- }
2229
- function ne() {
2230
- window.location.href = "/";
2231
- }
2232
- return (O, a) => n.value === "check" ? (v(), A(t(G), {
2233
- key: 0,
2234
- type: "warning",
2235
- title: "注销账号"
2236
- }, {
2237
- action: l(() => [p(t($), {
2238
- size: s.size,
2239
- type: "primary",
2240
- status: "danger",
2241
- loading: g.value,
2242
- onClick: z
2243
- }, {
2244
- default: l(() => [b(T(g.value ? "检查中..." : "开始注销"), 1)]),
2245
- _: 1
2246
- }, 8, ["size", "loading"])]),
2247
- default: l(() => [a[10] || (a[10] = b(" 注销账号后,登录凭据、第三方绑定和当前登录态会被清除;历史订单、用量、审计等业务记录会保留用于对账和安全追溯。 ", -1))]),
2248
- _: 1
2249
- })) : n.value === "dependencies" ? (v(), M(te, {
2250
- key: 1
2251
- }, [p(t(G), {
2252
- type: "error",
2253
- title: "无法注销账号"
2254
- }, {
2255
- default: l(() => [...a[11] || (a[11] = [b(" 您的账号下还有以下资源,请先处理后再注销: ", -1)])]),
2256
- _: 1
2257
- }), k("div", $i, [(v(!0), M(te, null, De(y.value, (R) => (v(), M("div", {
2258
- key: R.type,
2259
- class: "dependency-item"
2260
- }, [k("span", Ti, T(R.label), 1), k("span", Ui, T(R.count) + " 个", 1)]))), 128))]), k("div", xi, [p(t($), {
2261
- size: s.size,
2262
- onClick: a[0] || (a[0] = (R) => n.value = "check")
2263
- }, {
2264
- default: l(() => [...a[12] || (a[12] = [b("返回", -1)])]),
2265
- _: 1
2266
- }, 8, ["size"])])], 64)) : n.value === "chooseMethod" ? (v(), A(t(G), {
2267
- key: 2,
2268
- type: "normal",
2269
- title: "选择验证方式"
2270
- }, {
2271
- action: l(() => [p(t(pe), null, {
2272
- default: l(() => {
2273
- var R, N;
2274
- return [p(t($), {
2275
- size: s.size,
2276
- onClick: a[1] || (a[1] = (H) => n.value = "check")
2277
- }, {
2278
- default: l(() => [...a[13] || (a[13] = [b("取消", -1)])]),
2279
- _: 1
2280
- }, 8, ["size"]), (R = t(u)) != null && R.email ? (v(), A(t($), {
2281
- key: 0,
2282
- size: s.size,
2283
- type: "primary",
2284
- onClick: a[2] || (a[2] = (H) => K("email"))
2285
- }, {
2286
- default: l(() => [...a[14] || (a[14] = [b(" 邮箱验证 ", -1)])]),
2287
- _: 1
2288
- }, 8, ["size"])) : C("", !0), (N = t(u)) != null && N.phone ? (v(), A(t($), {
2289
- key: 1,
2290
- size: s.size,
2291
- type: "primary",
2292
- onClick: a[3] || (a[3] = (H) => K("phone"))
2293
- }, {
2294
- default: l(() => [...a[15] || (a[15] = [b(" 手机验证 ", -1)])]),
2295
- _: 1
2296
- }, 8, ["size"])) : C("", !0)];
2297
- }),
2298
- _: 1
2299
- })]),
2300
- default: l(() => [a[16] || (a[16] = b(" 请选择一种已绑定的身份验证方式。 ", -1))]),
2301
- _: 1
2302
- })) : n.value === "sendCode" ? (v(), A(t(G), {
2303
- key: 3,
2304
- type: "normal",
2305
- title: "身份验证"
2306
- }, {
2307
- action: l(() => [p(t(pe), null, {
2308
- default: l(() => [p(t($), {
2309
- size: s.size,
2310
- onClick: a[4] || (a[4] = (R) => n.value = "check")
2311
- }, {
2312
- default: l(() => [...a[17] || (a[17] = [b("取消", -1)])]),
2313
- _: 1
2314
- }, 8, ["size"]), p(t($), {
2315
- size: s.size,
2316
- type: "primary",
2317
- loading: f.value,
2318
- onClick: F
2319
- }, {
2320
- default: l(() => [b(T(f.value ? "发送中..." : "发送验证码"), 1)]),
2321
- _: 1
2322
- }, 8, ["size", "loading"])]),
2323
- _: 1
2324
- })]),
2325
- default: l(() => [b(T(V.value) + " ", 1)]),
2326
- _: 1
2327
- })) : n.value === "confirm" ? (v(), M(te, {
2328
- key: 4
2329
- }, [p(t(G), {
2330
- type: "warning",
2331
- title: "确认注销"
2332
- }, {
2333
- default: l(() => [b(T(P.value), 1)]),
2334
- _: 1
2335
- }), p(t(oe), {
2336
- ref_key: "formRef",
2337
- ref: D,
2338
- model: U.value,
2339
- size: s.size,
2340
- class: "confirm-form",
2341
- layout: "vertical"
2342
- }, {
2343
- default: l(() => {
2344
- var R;
2345
- return [I.value === "email" ? (v(), A(t(L), {
2346
- key: 0,
2347
- field: "userToken",
2348
- label: "邮箱验证码",
2349
- rules: [{
2350
- required: !0,
2351
- message: "请输入验证码"
2352
- }]
2353
- }, {
2354
- default: l(() => [k("div", Oi, [p(t(Q), {
2355
- modelValue: U.value.userToken,
2356
- "onUpdate:modelValue": a[5] || (a[5] = (N) => U.value.userToken = N),
2357
- placeholder: "请输入6位验证码",
2358
- "max-length": 6,
2359
- "allow-clear": ""
2360
- }, null, 8, ["modelValue"]), p(t($), {
2361
- disabled: d.value > 0,
2362
- loading: f.value,
2363
- onClick: F
2364
- }, {
2365
- default: l(() => [b(T(d.value > 0 ? `${d.value}s 后重发` : "重新发送"), 1)]),
2366
- _: 1
2367
- }, 8, ["disabled", "loading"])])]),
2368
- _: 1
2369
- })) : (v(), A(t(L), {
2370
- key: 1,
2371
- field: "code",
2372
- label: "短信验证码",
2373
- rules: [{
2374
- required: !0,
2375
- message: "请输入验证码"
2376
- }]
2377
- }, {
2378
- default: l(() => [k("div", Ni, [p(t(Q), {
2379
- modelValue: U.value.code,
2380
- "onUpdate:modelValue": a[6] || (a[6] = (N) => U.value.code = N),
2381
- placeholder: "请输入验证码",
2382
- "allow-clear": ""
2383
- }, null, 8, ["modelValue"]), p(t($), {
2384
- disabled: d.value > 0,
2385
- loading: f.value,
2386
- onClick: F
2387
- }, {
2388
- default: l(() => [b(T(d.value > 0 ? `${d.value}s 后重发` : "重新发送"), 1)]),
2389
- _: 1
2390
- }, 8, ["disabled", "loading"])])]),
2391
- _: 1
2392
- })), (R = t(u)) != null && R.hasPassword ? (v(), A(t(L), {
2393
- key: 2,
2394
- field: "password",
2395
- label: "登录密码",
2396
- rules: [{
2397
- required: !0,
2398
- message: "请输入密码"
2399
- }]
2400
- }, {
2401
- default: l(() => [p(t(Le), {
2402
- modelValue: U.value.password,
2403
- "onUpdate:modelValue": a[7] || (a[7] = (N) => U.value.password = N),
2404
- placeholder: "请输入您的登录密码",
2405
- "allow-clear": ""
2406
- }, null, 8, ["modelValue"])]),
2407
- _: 1
2408
- })) : C("", !0), p(t(L), {
2409
- field: "confirmText",
2410
- label: "请输入「注销」以确认",
2411
- rules: [{
2412
- required: !0,
2413
- message: "请输入确认文字"
2414
- }, {
2415
- validator: w
2416
- }]
2417
- }, {
2418
- default: l(() => [p(t(Q), {
2419
- modelValue: U.value.confirmText,
2420
- "onUpdate:modelValue": a[8] || (a[8] = (N) => U.value.confirmText = N),
2421
- placeholder: "注销",
2422
- "allow-clear": ""
2423
- }, null, 8, ["modelValue"])]),
2424
- _: 1
2425
- }, 8, ["rules"]), p(t(L), null, {
2426
- default: l(() => [p(t(pe), null, {
2427
- default: l(() => [p(t($), {
2428
- onClick: a[9] || (a[9] = (N) => n.value = "check")
2429
- }, {
2430
- default: l(() => [...a[18] || (a[18] = [b("取消", -1)])]),
2431
- _: 1
2432
- }), p(t($), {
2433
- type: "primary",
2434
- status: "danger",
2435
- loading: j.value,
2436
- onClick: X
2437
- }, {
2438
- default: l(() => [b(T(j.value ? "注销中..." : "确认注销"), 1)]),
2439
- _: 1
2440
- }, 8, ["loading"])]),
2441
- _: 1
2442
- })]),
2443
- _: 1
2444
- })];
2445
- }),
2446
- _: 1
2447
- }, 8, ["model", "size"])], 64)) : n.value === "success" ? (v(), A(t(Me), {
2448
- key: 5,
2449
- status: "success",
2450
- title: "账号已注销"
2451
- }, {
2452
- subtitle: l(() => [...a[19] || (a[19] = [b(" 您的账号已成功注销,登录凭据和绑定身份已清除 ", -1)])]),
2453
- extra: l(() => [p(t($), {
2454
- type: "primary",
2455
- onClick: ne
2456
- }, {
2457
- default: l(() => [...a[20] || (a[20] = [b("返回首页", -1)])]),
2458
- _: 1
2459
- })]),
2460
- _: 1
2461
- })) : C("", !0);
2462
- }
2463
- }), qi = /* @__PURE__ */ Z(Di, [["__scopeId", "data-v-43c17dbe"]]), Bi = {
2464
- class: "content"
2465
- }, Li = {
2466
- class: "left"
2467
- }, Mi = {
2468
- class: "right"
2469
- }, Ki = /* @__PURE__ */ Y({
2470
- __name: "AuthkitAppSetting",
2471
- emits: ["confirm", "cancel"],
2472
- setup(i, {
2473
- expose: e,
2474
- emit: s
2475
- }) {
2476
- const c = s;
2477
- function u() {
2478
- U.value = !1, n.value = ["PersonalInformation"], c("cancel");
2479
- }
2480
- function o() {
2481
- u();
2482
- }
2483
- const r = _("large"), n = _(["PersonalInformation"]), g = [{
2484
- provider: "github",
2485
- name: fe.github,
2486
- meta: {
2487
- icon: le.github
2488
- }
2489
- }, {
2490
- provider: "google",
2491
- name: fe.google,
2492
- meta: {
2493
- icon: le.google
2494
- }
2495
- }, {
2496
- provider: "microsoft",
2497
- name: fe.microsoft,
2498
- meta: {
2499
- icon: le.microsoft
2500
- }
2501
- }, {
2502
- provider: "wechat",
2503
- name: fe.wechat,
2504
- meta: {
2505
- icon: le.wechat
2506
- }
2507
- }], {
2508
- appsData: y
2509
- } = Ee(), f = S(() => {
2510
- const w = y.value.authMethods;
2511
- return w.signUp.email || w.login.emailPassword || w.login.emailCode;
2512
- }), h = S(() => {
2513
- const w = y.value.authMethods;
2514
- return w.signUp.phone || w.login.phonePassword || w.login.phoneCode;
2515
- }), d = S(() => {
2516
- const w = y.value.authMethods;
2517
- return w.login.emailPassword || w.login.phonePassword;
2518
- }), m = S(() => d.value || f.value || h.value), I = S(() => y.value.authMethods.login.passkey), E = S(() => g.filter((w) => {
2519
- var z, K;
2520
- return (K = (z = y.value.oauth) == null ? void 0 : z[w.provider]) == null ? void 0 : K.enabled;
2521
- }).map((w) => ({
2522
- ...w,
2523
- path: `OAuthBinding:${w.provider}`
2524
- }))), q = S(() => {
2525
- const w = [];
2526
- f.value && w.push({
2527
- name: "邮箱",
2528
- path: "EmailBinding",
2529
- meta: {
2530
- icon: "ic:baseline-email"
2531
- }
2532
- }), h.value && w.push({
2533
- name: "手机号",
2534
- path: "PhoneBinding",
2535
- meta: {
2536
- icon: "mingcute:phone-fill"
2537
- }
2538
- }), m.value && w.push({
2539
- name: "登录密码",
2540
- path: "SetPassword",
2541
- meta: {
2542
- icon: "mdi:password"
2543
- }
2544
- }), I.value && w.push({
2545
- name: "Passkey",
2546
- path: "PasskeyBinding",
2547
- meta: {
2548
- icon: bi
2549
- }
2550
- }), w.push({
2551
- name: "注销账号",
2552
- path: "AccountDelete",
2553
- meta: {
2554
- icon: "mdi:account-remove"
2555
- }
2556
- });
2557
- const z = [{
2558
- name: "个人信息",
2559
- path: "PersonalInformation",
2560
- meta: {
2561
- icon: "mingcute:user-edit-fill"
2562
- },
2563
- children: []
2564
- }, {
2565
- name: "账户管理",
2566
- path: "AccountManage",
2567
- meta: {
2568
- icon: "mingcute:badge-fill"
2569
- },
2570
- children: w
2571
- }];
2572
- return E.value.length > 0 && z.push({
2573
- name: "第三方账户",
2574
- path: "AccountBinding",
2575
- meta: {
2576
- icon: "mingcute:link-fill"
2577
- },
2578
- children: E.value
2579
- }), z;
2580
- }), V = S(() => E.value.find((w) => w.path === n.value[0]));
2581
- function P(w) {
2582
- const z = w.path;
2583
- n.value = [z];
2584
- }
2585
- const {
2586
- changeType: D,
2587
- show: U
2588
- } = Ze(c);
2589
- Ae(E, (w) => {
2590
- n.value[0].startsWith("OAuthBinding:") && !w.some((z) => z.path === n.value[0]) && (n.value = ["PersonalInformation"]);
2591
- }), Ae(q, (w) => {
2592
- const z = n.value[0];
2593
- w.some((F) => {
2594
- var B;
2595
- return F.path === z || ((B = F.children) == null ? void 0 : B.some((X) => X.path === z));
2596
- }) || (n.value = ["PersonalInformation"]);
2597
- });
2598
- function j(w, z) {
2599
- U.value = z, D.value = "编辑";
2600
- }
2601
- return e({
2602
- setData: j
2603
- }), (w, z) => t(U) ? (v(), A(t(Ke), {
2604
- key: 0,
2605
- visible: !0,
2606
- "body-class": "AppSettingbodyClass",
2607
- "mask-closable": !1,
2608
- footer: !1,
2609
- width: t(Ue),
2610
- onCancel: u
2611
- }, {
2612
- title: l(() => [...z[1] || (z[1] = [b(" 用户信息 ", -1)])]),
2613
- default: l(() => [k("div", Bi, [k("div", Li, [p(Qe, {
2614
- "selected-keys": n.value,
2615
- "onUpdate:selectedKeys": z[0] || (z[0] = (K) => n.value = K),
2616
- menus: q.value,
2617
- onChange: P
2618
- }, null, 8, ["selected-keys", "menus"])]), k("div", Mi, [n.value[0] === "PersonalInformation" ? (v(), A(vt, {
2619
- key: 0,
2620
- size: r.value
2621
- }, null, 8, ["size"])) : C("", !0), n.value[0] === "EmailBinding" ? (v(), A(Xt, {
2622
- key: 1,
2623
- size: r.value
2624
- }, null, 8, ["size"])) : C("", !0), n.value[0] === "PhoneBinding" ? (v(), A(ui, {
2625
- key: 2,
2626
- size: r.value
2627
- }, null, 8, ["size"])) : C("", !0), n.value[0] === "SetPassword" ? (v(), A(It, {
2628
- key: 3,
2629
- size: r.value
2630
- }, null, 8, ["size"])) : C("", !0), n.value[0] === "PasskeyBinding" ? (v(), A(Ft, {
2631
- key: 4,
2632
- size: r.value
2633
- }, null, 8, ["size"])) : C("", !0), V.value ? (v(), A(Vi, {
2634
- key: 5,
2635
- provider: V.value.provider,
2636
- label: V.value.name,
2637
- size: r.value
2638
- }, null, 8, ["provider", "label", "size"])) : C("", !0), n.value[0] === "AccountDelete" ? (v(), A(qi, {
2639
- key: 6,
2640
- size: r.value,
2641
- onDeleted: o
2642
- }, null, 8, ["size"])) : C("", !0)])])]),
2643
- _: 1
2644
- }, 8, ["width"])) : C("", !0);
2645
- }
2646
- }), pn = /* @__PURE__ */ Z(Ki, [["__scopeId", "data-v-944e5438"]]);
2647
- export {
2648
- pn as A,
2649
- Qt as B,
2650
- Vi as O,
2651
- Ft as P,
2652
- ve as S,
2653
- Xt as _,
2654
- ri as a,
2655
- ye as b,
2656
- Ct as c,
2657
- vt as d,
2658
- ui as e,
2659
- ge as f,
2660
- It as g,
2661
- hi as h,
2662
- ki as i,
2663
- cn as j,
2664
- wi as k,
2665
- ae as l,
2666
- fn as m,
2667
- le as n,
2668
- _i as o,
2669
- bi as p,
2670
- he as q,
2671
- di as r,
2672
- zi as s,
2673
- qt as u
2674
- };