com-angel-authorization 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +122 -11
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +122 -11
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +138 -17
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +2 -1
- package/dist/vue/index.d.ts +2 -1
- package/dist/vue/index.js +138 -17
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1686,11 +1686,10 @@ function MenuManager({
|
|
|
1686
1686
|
)
|
|
1687
1687
|
] })
|
|
1688
1688
|
] }),
|
|
1689
|
-
dialogOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.mask,
|
|
1689
|
+
dialogOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.mask, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1690
1690
|
"div",
|
|
1691
1691
|
{
|
|
1692
1692
|
style: { ...styles2.dialog, maxWidth: 520 },
|
|
1693
|
-
onClick: (e) => e.stopPropagation(),
|
|
1694
1693
|
role: "dialog",
|
|
1695
1694
|
"aria-modal": "true",
|
|
1696
1695
|
children: [
|
|
@@ -1826,10 +1825,7 @@ function MenuManager({
|
|
|
1826
1825
|
opt.label
|
|
1827
1826
|
] }, opt.value)) })
|
|
1828
1827
|
] }),
|
|
1829
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1830
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", style: styles2.secondaryBtn, onClick: closeDialog, children: "\u53D6\u6D88" }),
|
|
1831
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "submit", style: styles2.primaryBtn, disabled: saving, children: saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58" })
|
|
1832
|
-
] })
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.dialogFooter, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "submit", style: styles2.primaryBtn, disabled: saving, children: saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58" }) })
|
|
1833
1829
|
] })
|
|
1834
1830
|
]
|
|
1835
1831
|
}
|
|
@@ -3093,9 +3089,9 @@ function mapSystemRoleOption(item) {
|
|
|
3093
3089
|
}
|
|
3094
3090
|
function validateUsername(username) {
|
|
3095
3091
|
const value = username.trim();
|
|
3096
|
-
if (value.length
|
|
3097
|
-
if (
|
|
3098
|
-
return "\u8D26\u53F7\u9700\
|
|
3092
|
+
if (value.length <= 1) return "\u8D26\u53F7\u957F\u5EA6\u9700\u5927\u4E8E 1";
|
|
3093
|
+
if (!/^(?=.*[A-Za-z])[A-Za-z0-9]+$/.test(value)) {
|
|
3094
|
+
return "\u8D26\u53F7\u9700\u5305\u542B\u82F1\u6587\u5B57\u6BCD\uFF0C\u53EF\u642D\u914D\u6570\u5B57\uFF0C\u4E0D\u652F\u6301\u4E2D\u6587\u6216\u7279\u6B8A\u7B26\u53F7\u3002";
|
|
3099
3095
|
}
|
|
3100
3096
|
return null;
|
|
3101
3097
|
}
|
|
@@ -3175,6 +3171,14 @@ function createSystemUserApi(request) {
|
|
|
3175
3171
|
signal
|
|
3176
3172
|
});
|
|
3177
3173
|
},
|
|
3174
|
+
async resetPassword(userId, password, signal) {
|
|
3175
|
+
return request({
|
|
3176
|
+
method: "POST",
|
|
3177
|
+
url: `/system/users/${encodeURIComponent(userId)}/reset-password`,
|
|
3178
|
+
body: { password },
|
|
3179
|
+
signal
|
|
3180
|
+
});
|
|
3181
|
+
},
|
|
3178
3182
|
async listGroups(params, signal) {
|
|
3179
3183
|
const json = await request({
|
|
3180
3184
|
method: "GET",
|
|
@@ -3228,6 +3232,10 @@ function UserManager({
|
|
|
3228
3232
|
const [saving, setSaving] = (0, import_react5.useState)(false);
|
|
3229
3233
|
const [deletingRow, setDeletingRow] = (0, import_react5.useState)(null);
|
|
3230
3234
|
const [deleting, setDeleting] = (0, import_react5.useState)(false);
|
|
3235
|
+
const [resetRow, setResetRow] = (0, import_react5.useState)(null);
|
|
3236
|
+
const [resetPassword, setResetPassword] = (0, import_react5.useState)("");
|
|
3237
|
+
const [resetError, setResetError] = (0, import_react5.useState)("");
|
|
3238
|
+
const [resetting, setResetting] = (0, import_react5.useState)(false);
|
|
3231
3239
|
const [groups, setGroups] = (0, import_react5.useState)([]);
|
|
3232
3240
|
const [roles, setRoles] = (0, import_react5.useState)([]);
|
|
3233
3241
|
const [rolesLoading, setRolesLoading] = (0, import_react5.useState)(false);
|
|
@@ -3391,6 +3399,38 @@ function UserManager({
|
|
|
3391
3399
|
setDeleting(false);
|
|
3392
3400
|
}
|
|
3393
3401
|
};
|
|
3402
|
+
const openResetPassword = (row) => {
|
|
3403
|
+
setResetRow(row);
|
|
3404
|
+
setResetPassword("");
|
|
3405
|
+
setResetError("");
|
|
3406
|
+
};
|
|
3407
|
+
const closeResetDialog = () => {
|
|
3408
|
+
if (!resetting) {
|
|
3409
|
+
setResetRow(null);
|
|
3410
|
+
setResetPassword("");
|
|
3411
|
+
setResetError("");
|
|
3412
|
+
}
|
|
3413
|
+
};
|
|
3414
|
+
const confirmResetPassword = async (event) => {
|
|
3415
|
+
event.preventDefault();
|
|
3416
|
+
if (!resetRow) return;
|
|
3417
|
+
if (!resetPassword.trim()) {
|
|
3418
|
+
setResetError("\u8BF7\u586B\u5199\u65B0\u5BC6\u7801");
|
|
3419
|
+
return;
|
|
3420
|
+
}
|
|
3421
|
+
setResetting(true);
|
|
3422
|
+
setResetError("");
|
|
3423
|
+
setError("");
|
|
3424
|
+
try {
|
|
3425
|
+
await api.resetPassword(resetRow.userId, resetPassword);
|
|
3426
|
+
setResetRow(null);
|
|
3427
|
+
setResetPassword("");
|
|
3428
|
+
} catch (err) {
|
|
3429
|
+
setResetError(err instanceof Error ? err.message : "\u91CD\u7F6E\u5BC6\u7801\u5931\u8D25");
|
|
3430
|
+
} finally {
|
|
3431
|
+
setResetting(false);
|
|
3432
|
+
}
|
|
3433
|
+
};
|
|
3394
3434
|
const groupLabel = (row) => {
|
|
3395
3435
|
if (row.groupNames?.length) return row.groupNames.join("\u3001");
|
|
3396
3436
|
if (!row.groupIds.length) return "\u2014";
|
|
@@ -3483,7 +3523,7 @@ function UserManager({
|
|
|
3483
3523
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: styles4.th, children: "\u5F52\u5C5E\u90E8\u95E8" }),
|
|
3484
3524
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: styles4.th, children: "\u7528\u6237\u89D2\u8272" }),
|
|
3485
3525
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...styles4.th, width: 90 }, children: "\u72B6\u6001" }),
|
|
3486
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...styles4.th, width:
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...styles4.th, width: 220 }, children: "\u64CD\u4F5C" })
|
|
3487
3527
|
] }) }),
|
|
3488
3528
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: 6, style: styles4.empty, children: "\u52A0\u8F7D\u4E2D\u2026" }) }) : records.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: 6, style: styles4.empty, children: "\u6682\u65E0\u6570\u636E" }) }) : records.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { children: [
|
|
3489
3529
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { style: styles4.td, children: row.username }),
|
|
@@ -3502,6 +3542,15 @@ function UserManager({
|
|
|
3502
3542
|
) }),
|
|
3503
3543
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { style: styles4.td, children: [
|
|
3504
3544
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: styles4.linkBtn, onClick: () => openEdit(row), children: "\u7F16\u8F91" }),
|
|
3545
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3546
|
+
"button",
|
|
3547
|
+
{
|
|
3548
|
+
type: "button",
|
|
3549
|
+
style: styles4.linkBtn,
|
|
3550
|
+
onClick: () => openResetPassword(row),
|
|
3551
|
+
children: "\u91CD\u7F6E\u5BC6\u7801"
|
|
3552
|
+
}
|
|
3553
|
+
),
|
|
3505
3554
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3506
3555
|
"button",
|
|
3507
3556
|
{
|
|
@@ -3575,7 +3624,7 @@ function UserManager({
|
|
|
3575
3624
|
style: styles4.input,
|
|
3576
3625
|
value: form.username,
|
|
3577
3626
|
onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
|
|
3578
|
-
placeholder: "\
|
|
3627
|
+
placeholder: "\u8D26\u53F7\u9700\u5305\u542B\u82F1\u6587\u5B57\u6BCD\uFF0C\u53EF\u642D\u914D\u6570\u5B57\uFF0C\u4E0D\u652F\u6301\u4E2D\u6587\u6216\u7279\u6B8A\u7B26\u53F7\u3002",
|
|
3579
3628
|
required: true
|
|
3580
3629
|
}
|
|
3581
3630
|
)
|
|
@@ -3750,6 +3799,68 @@ function UserManager({
|
|
|
3750
3799
|
] })
|
|
3751
3800
|
]
|
|
3752
3801
|
}
|
|
3802
|
+
) }) : null,
|
|
3803
|
+
resetRow ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.mask, onClick: closeResetDialog, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3804
|
+
"div",
|
|
3805
|
+
{
|
|
3806
|
+
style: { ...styles4.dialog, maxWidth: 420 },
|
|
3807
|
+
onClick: (e) => e.stopPropagation(),
|
|
3808
|
+
role: "dialog",
|
|
3809
|
+
"aria-modal": "true",
|
|
3810
|
+
children: [
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles4.dialogHeader, children: [
|
|
3812
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { style: styles4.dialogTitle, children: "\u91CD\u7F6E\u5BC6\u7801" }),
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3814
|
+
"button",
|
|
3815
|
+
{
|
|
3816
|
+
type: "button",
|
|
3817
|
+
style: styles4.iconBtn,
|
|
3818
|
+
onClick: closeResetDialog,
|
|
3819
|
+
"aria-label": "\u5173\u95ED",
|
|
3820
|
+
children: "\xD7"
|
|
3821
|
+
}
|
|
3822
|
+
)
|
|
3823
|
+
] }),
|
|
3824
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { style: styles4.form, onSubmit: (e) => void confirmResetPassword(e), children: [
|
|
3825
|
+
resetError ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.error, children: resetError }) : null,
|
|
3826
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: styles4.confirmText, children: [
|
|
3827
|
+
"\u4E3A\u7528\u6237\u300C",
|
|
3828
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: resetRow.name }),
|
|
3829
|
+
"\u300D\uFF08",
|
|
3830
|
+
resetRow.username,
|
|
3831
|
+
"\uFF09\u8BBE\u7F6E\u65B0\u5BC6\u7801"
|
|
3832
|
+
] }),
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3834
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.label, children: "\u65B0\u5BC6\u7801" }),
|
|
3835
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3836
|
+
"input",
|
|
3837
|
+
{
|
|
3838
|
+
style: styles4.input,
|
|
3839
|
+
type: "password",
|
|
3840
|
+
value: resetPassword,
|
|
3841
|
+
onChange: (e) => setResetPassword(e.target.value),
|
|
3842
|
+
placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",
|
|
3843
|
+
required: true,
|
|
3844
|
+
autoComplete: "new-password"
|
|
3845
|
+
}
|
|
3846
|
+
)
|
|
3847
|
+
] }),
|
|
3848
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles4.dialogFooter, children: [
|
|
3849
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3850
|
+
"button",
|
|
3851
|
+
{
|
|
3852
|
+
type: "button",
|
|
3853
|
+
style: styles4.secondaryBtn,
|
|
3854
|
+
onClick: closeResetDialog,
|
|
3855
|
+
disabled: resetting,
|
|
3856
|
+
children: "\u53D6\u6D88"
|
|
3857
|
+
}
|
|
3858
|
+
),
|
|
3859
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "submit", style: styles4.primaryBtn, disabled: resetting, children: resetting ? "\u63D0\u4EA4\u4E2D\u2026" : "\u786E\u8BA4\u91CD\u7F6E" })
|
|
3860
|
+
] })
|
|
3861
|
+
] })
|
|
3862
|
+
]
|
|
3863
|
+
}
|
|
3753
3864
|
) }) : null
|
|
3754
3865
|
] });
|
|
3755
3866
|
}
|