com-angel-authorization 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- 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 +136 -12
- 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 +136 -12
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +152 -16
- 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 +152 -16
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -3089,9 +3089,9 @@ function mapSystemRoleOption(item) {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
function validateUsername(username) {
|
|
3091
3091
|
const value = username.trim();
|
|
3092
|
-
if (value.length
|
|
3093
|
-
if (
|
|
3094
|
-
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";
|
|
3095
3095
|
}
|
|
3096
3096
|
return null;
|
|
3097
3097
|
}
|
|
@@ -3171,6 +3171,14 @@ function createSystemUserApi(request) {
|
|
|
3171
3171
|
signal
|
|
3172
3172
|
});
|
|
3173
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
|
+
},
|
|
3174
3182
|
async listGroups(params, signal) {
|
|
3175
3183
|
const json = await request({
|
|
3176
3184
|
method: "GET",
|
|
@@ -3224,6 +3232,10 @@ function UserManager({
|
|
|
3224
3232
|
const [saving, setSaving] = (0, import_react5.useState)(false);
|
|
3225
3233
|
const [deletingRow, setDeletingRow] = (0, import_react5.useState)(null);
|
|
3226
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);
|
|
3227
3239
|
const [groups, setGroups] = (0, import_react5.useState)([]);
|
|
3228
3240
|
const [roles, setRoles] = (0, import_react5.useState)([]);
|
|
3229
3241
|
const [rolesLoading, setRolesLoading] = (0, import_react5.useState)(false);
|
|
@@ -3387,6 +3399,38 @@ function UserManager({
|
|
|
3387
3399
|
setDeleting(false);
|
|
3388
3400
|
}
|
|
3389
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
|
+
};
|
|
3390
3434
|
const groupLabel = (row) => {
|
|
3391
3435
|
if (row.groupNames?.length) return row.groupNames.join("\u3001");
|
|
3392
3436
|
if (!row.groupIds.length) return "\u2014";
|
|
@@ -3479,7 +3523,7 @@ function UserManager({
|
|
|
3479
3523
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: styles4.th, children: "\u5F52\u5C5E\u90E8\u95E8" }),
|
|
3480
3524
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: styles4.th, children: "\u7528\u6237\u89D2\u8272" }),
|
|
3481
3525
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...styles4.th, width: 90 }, children: "\u72B6\u6001" }),
|
|
3482
|
-
/* @__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" })
|
|
3483
3527
|
] }) }),
|
|
3484
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: [
|
|
3485
3529
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { style: styles4.td, children: row.username }),
|
|
@@ -3498,6 +3542,15 @@ function UserManager({
|
|
|
3498
3542
|
) }),
|
|
3499
3543
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { style: styles4.td, children: [
|
|
3500
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
|
+
),
|
|
3501
3554
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3502
3555
|
"button",
|
|
3503
3556
|
{
|
|
@@ -3564,20 +3617,26 @@ function UserManager({
|
|
|
3564
3617
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { style: styles4.form, onSubmit: (e) => void handleSubmit(e), children: [
|
|
3565
3618
|
formError ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.error, children: formError }) : null,
|
|
3566
3619
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3567
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3621
|
+
"\u8D26\u53F7 ",
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3623
|
+
] }),
|
|
3568
3624
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3569
3625
|
"input",
|
|
3570
3626
|
{
|
|
3571
3627
|
style: styles4.input,
|
|
3572
3628
|
value: form.username,
|
|
3573
3629
|
onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
|
|
3574
|
-
placeholder: "\
|
|
3630
|
+
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",
|
|
3575
3631
|
required: true
|
|
3576
3632
|
}
|
|
3577
3633
|
)
|
|
3578
3634
|
] }),
|
|
3579
3635
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3580
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3637
|
+
"\u7528\u6237\u540D ",
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3639
|
+
] }),
|
|
3581
3640
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3582
3641
|
"input",
|
|
3583
3642
|
{
|
|
@@ -3589,8 +3648,11 @@ function UserManager({
|
|
|
3589
3648
|
}
|
|
3590
3649
|
)
|
|
3591
3650
|
] }),
|
|
3592
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3593
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3651
|
+
!editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3653
|
+
"\u521D\u59CB\u5BC6\u7801 ",
|
|
3654
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3655
|
+
] }),
|
|
3594
3656
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3595
3657
|
"input",
|
|
3596
3658
|
{
|
|
@@ -3598,12 +3660,12 @@ function UserManager({
|
|
|
3598
3660
|
type: "password",
|
|
3599
3661
|
value: form.password,
|
|
3600
3662
|
onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
|
|
3601
|
-
placeholder:
|
|
3602
|
-
required:
|
|
3663
|
+
placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
|
|
3664
|
+
required: true,
|
|
3603
3665
|
autoComplete: "new-password"
|
|
3604
3666
|
}
|
|
3605
3667
|
)
|
|
3606
|
-
] }),
|
|
3668
|
+
] }) : null,
|
|
3607
3669
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("fieldset", { style: styles4.fieldset, children: [
|
|
3608
3670
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("legend", { style: styles4.label, children: [
|
|
3609
3671
|
"\u5F52\u5C5E\u90E8\u95E8 ",
|
|
@@ -3746,6 +3808,68 @@ function UserManager({
|
|
|
3746
3808
|
] })
|
|
3747
3809
|
]
|
|
3748
3810
|
}
|
|
3811
|
+
) }) : null,
|
|
3812
|
+
resetRow ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.mask, onClick: closeResetDialog, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3813
|
+
"div",
|
|
3814
|
+
{
|
|
3815
|
+
style: { ...styles4.dialog, maxWidth: 420 },
|
|
3816
|
+
onClick: (e) => e.stopPropagation(),
|
|
3817
|
+
role: "dialog",
|
|
3818
|
+
"aria-modal": "true",
|
|
3819
|
+
children: [
|
|
3820
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles4.dialogHeader, children: [
|
|
3821
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { style: styles4.dialogTitle, children: "\u91CD\u7F6E\u5BC6\u7801" }),
|
|
3822
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3823
|
+
"button",
|
|
3824
|
+
{
|
|
3825
|
+
type: "button",
|
|
3826
|
+
style: styles4.iconBtn,
|
|
3827
|
+
onClick: closeResetDialog,
|
|
3828
|
+
"aria-label": "\u5173\u95ED",
|
|
3829
|
+
children: "\xD7"
|
|
3830
|
+
}
|
|
3831
|
+
)
|
|
3832
|
+
] }),
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { style: styles4.form, onSubmit: (e) => void confirmResetPassword(e), children: [
|
|
3834
|
+
resetError ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.error, children: resetError }) : null,
|
|
3835
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: styles4.confirmText, children: [
|
|
3836
|
+
"\u4E3A\u7528\u6237\u300C",
|
|
3837
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: resetRow.name }),
|
|
3838
|
+
"\u300D\uFF08",
|
|
3839
|
+
resetRow.username,
|
|
3840
|
+
"\uFF09\u8BBE\u7F6E\u65B0\u5BC6\u7801"
|
|
3841
|
+
] }),
|
|
3842
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3843
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.label, children: "\u65B0\u5BC6\u7801" }),
|
|
3844
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3845
|
+
"input",
|
|
3846
|
+
{
|
|
3847
|
+
style: styles4.input,
|
|
3848
|
+
type: "password",
|
|
3849
|
+
value: resetPassword,
|
|
3850
|
+
onChange: (e) => setResetPassword(e.target.value),
|
|
3851
|
+
placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",
|
|
3852
|
+
required: true,
|
|
3853
|
+
autoComplete: "new-password"
|
|
3854
|
+
}
|
|
3855
|
+
)
|
|
3856
|
+
] }),
|
|
3857
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles4.dialogFooter, children: [
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3859
|
+
"button",
|
|
3860
|
+
{
|
|
3861
|
+
type: "button",
|
|
3862
|
+
style: styles4.secondaryBtn,
|
|
3863
|
+
onClick: closeResetDialog,
|
|
3864
|
+
disabled: resetting,
|
|
3865
|
+
children: "\u53D6\u6D88"
|
|
3866
|
+
}
|
|
3867
|
+
),
|
|
3868
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "submit", style: styles4.primaryBtn, disabled: resetting, children: resetting ? "\u63D0\u4EA4\u4E2D\u2026" : "\u786E\u8BA4\u91CD\u7F6E" })
|
|
3869
|
+
] })
|
|
3870
|
+
] })
|
|
3871
|
+
]
|
|
3872
|
+
}
|
|
3749
3873
|
) }) : null
|
|
3750
3874
|
] });
|
|
3751
3875
|
}
|