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.d.cts
CHANGED
|
@@ -503,6 +503,7 @@ type SystemUserApi = {
|
|
|
503
503
|
create: (values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
504
504
|
update: (userId: string, values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
505
505
|
remove: (userId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
506
|
+
resetPassword: (userId: string, password: string, signal?: AbortSignal) => Promise<unknown>;
|
|
506
507
|
listGroups: (params?: FetchSystemGroupsParams, signal?: AbortSignal) => Promise<SystemGroupOption[]>;
|
|
507
508
|
listRoleOptions: (params?: FetchSystemRoleOptionsParams, signal?: AbortSignal) => Promise<SystemRoleOption[]>;
|
|
508
509
|
};
|
|
@@ -510,7 +511,7 @@ declare function mapSystemUser(item: unknown): SystemUser | null;
|
|
|
510
511
|
declare function mapSystemGroupOption(item: unknown): SystemGroupOption | null;
|
|
511
512
|
declare function mapSystemRoleOption(item: unknown): SystemRoleOption | null;
|
|
512
513
|
/**
|
|
513
|
-
*
|
|
514
|
+
* 账号校验:长度大于 1;须含英文字母,可搭配数字;不支持中文或特殊符号。
|
|
514
515
|
* 通过返回 null,失败返回错误文案。
|
|
515
516
|
*/
|
|
516
517
|
declare function validateUsername(username: string): string | null;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -503,6 +503,7 @@ type SystemUserApi = {
|
|
|
503
503
|
create: (values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
504
504
|
update: (userId: string, values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
505
505
|
remove: (userId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
506
|
+
resetPassword: (userId: string, password: string, signal?: AbortSignal) => Promise<unknown>;
|
|
506
507
|
listGroups: (params?: FetchSystemGroupsParams, signal?: AbortSignal) => Promise<SystemGroupOption[]>;
|
|
507
508
|
listRoleOptions: (params?: FetchSystemRoleOptionsParams, signal?: AbortSignal) => Promise<SystemRoleOption[]>;
|
|
508
509
|
};
|
|
@@ -510,7 +511,7 @@ declare function mapSystemUser(item: unknown): SystemUser | null;
|
|
|
510
511
|
declare function mapSystemGroupOption(item: unknown): SystemGroupOption | null;
|
|
511
512
|
declare function mapSystemRoleOption(item: unknown): SystemRoleOption | null;
|
|
512
513
|
/**
|
|
513
|
-
*
|
|
514
|
+
* 账号校验:长度大于 1;须含英文字母,可搭配数字;不支持中文或特殊符号。
|
|
514
515
|
* 通过返回 null,失败返回错误文案。
|
|
515
516
|
*/
|
|
516
517
|
declare function validateUsername(username: string): string | null;
|
package/dist/react/index.js
CHANGED
|
@@ -3025,9 +3025,9 @@ function mapSystemRoleOption(item) {
|
|
|
3025
3025
|
}
|
|
3026
3026
|
function validateUsername(username) {
|
|
3027
3027
|
const value = username.trim();
|
|
3028
|
-
if (value.length
|
|
3029
|
-
if (
|
|
3030
|
-
return "\u8D26\u53F7\u9700\
|
|
3028
|
+
if (value.length <= 1) return "\u8D26\u53F7\u957F\u5EA6\u9700\u5927\u4E8E 1";
|
|
3029
|
+
if (!/^(?=.*[A-Za-z])[A-Za-z0-9]+$/.test(value)) {
|
|
3030
|
+
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";
|
|
3031
3031
|
}
|
|
3032
3032
|
return null;
|
|
3033
3033
|
}
|
|
@@ -3107,6 +3107,14 @@ function createSystemUserApi(request) {
|
|
|
3107
3107
|
signal
|
|
3108
3108
|
});
|
|
3109
3109
|
},
|
|
3110
|
+
async resetPassword(userId, password, signal) {
|
|
3111
|
+
return request({
|
|
3112
|
+
method: "POST",
|
|
3113
|
+
url: `/system/users/${encodeURIComponent(userId)}/reset-password`,
|
|
3114
|
+
body: { password },
|
|
3115
|
+
signal
|
|
3116
|
+
});
|
|
3117
|
+
},
|
|
3110
3118
|
async listGroups(params, signal) {
|
|
3111
3119
|
const json = await request({
|
|
3112
3120
|
method: "GET",
|
|
@@ -3160,6 +3168,10 @@ function UserManager({
|
|
|
3160
3168
|
const [saving, setSaving] = useState5(false);
|
|
3161
3169
|
const [deletingRow, setDeletingRow] = useState5(null);
|
|
3162
3170
|
const [deleting, setDeleting] = useState5(false);
|
|
3171
|
+
const [resetRow, setResetRow] = useState5(null);
|
|
3172
|
+
const [resetPassword, setResetPassword] = useState5("");
|
|
3173
|
+
const [resetError, setResetError] = useState5("");
|
|
3174
|
+
const [resetting, setResetting] = useState5(false);
|
|
3163
3175
|
const [groups, setGroups] = useState5([]);
|
|
3164
3176
|
const [roles, setRoles] = useState5([]);
|
|
3165
3177
|
const [rolesLoading, setRolesLoading] = useState5(false);
|
|
@@ -3323,6 +3335,38 @@ function UserManager({
|
|
|
3323
3335
|
setDeleting(false);
|
|
3324
3336
|
}
|
|
3325
3337
|
};
|
|
3338
|
+
const openResetPassword = (row) => {
|
|
3339
|
+
setResetRow(row);
|
|
3340
|
+
setResetPassword("");
|
|
3341
|
+
setResetError("");
|
|
3342
|
+
};
|
|
3343
|
+
const closeResetDialog = () => {
|
|
3344
|
+
if (!resetting) {
|
|
3345
|
+
setResetRow(null);
|
|
3346
|
+
setResetPassword("");
|
|
3347
|
+
setResetError("");
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3350
|
+
const confirmResetPassword = async (event) => {
|
|
3351
|
+
event.preventDefault();
|
|
3352
|
+
if (!resetRow) return;
|
|
3353
|
+
if (!resetPassword.trim()) {
|
|
3354
|
+
setResetError("\u8BF7\u586B\u5199\u65B0\u5BC6\u7801");
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
setResetting(true);
|
|
3358
|
+
setResetError("");
|
|
3359
|
+
setError("");
|
|
3360
|
+
try {
|
|
3361
|
+
await api.resetPassword(resetRow.userId, resetPassword);
|
|
3362
|
+
setResetRow(null);
|
|
3363
|
+
setResetPassword("");
|
|
3364
|
+
} catch (err) {
|
|
3365
|
+
setResetError(err instanceof Error ? err.message : "\u91CD\u7F6E\u5BC6\u7801\u5931\u8D25");
|
|
3366
|
+
} finally {
|
|
3367
|
+
setResetting(false);
|
|
3368
|
+
}
|
|
3369
|
+
};
|
|
3326
3370
|
const groupLabel = (row) => {
|
|
3327
3371
|
if (row.groupNames?.length) return row.groupNames.join("\u3001");
|
|
3328
3372
|
if (!row.groupIds.length) return "\u2014";
|
|
@@ -3415,7 +3459,7 @@ function UserManager({
|
|
|
3415
3459
|
/* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u5F52\u5C5E\u90E8\u95E8" }),
|
|
3416
3460
|
/* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u7528\u6237\u89D2\u8272" }),
|
|
3417
3461
|
/* @__PURE__ */ jsx5("th", { style: { ...styles4.th, width: 90 }, children: "\u72B6\u6001" }),
|
|
3418
|
-
/* @__PURE__ */ jsx5("th", { style: { ...styles4.th, width:
|
|
3462
|
+
/* @__PURE__ */ jsx5("th", { style: { ...styles4.th, width: 220 }, children: "\u64CD\u4F5C" })
|
|
3419
3463
|
] }) }),
|
|
3420
3464
|
/* @__PURE__ */ jsx5("tbody", { children: loading ? /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 6, style: styles4.empty, children: "\u52A0\u8F7D\u4E2D\u2026" }) }) : records.length === 0 ? /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 6, style: styles4.empty, children: "\u6682\u65E0\u6570\u636E" }) }) : records.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
|
|
3421
3465
|
/* @__PURE__ */ jsx5("td", { style: styles4.td, children: row.username }),
|
|
@@ -3434,6 +3478,15 @@ function UserManager({
|
|
|
3434
3478
|
) }),
|
|
3435
3479
|
/* @__PURE__ */ jsxs4("td", { style: styles4.td, children: [
|
|
3436
3480
|
/* @__PURE__ */ jsx5("button", { type: "button", style: styles4.linkBtn, onClick: () => openEdit(row), children: "\u7F16\u8F91" }),
|
|
3481
|
+
/* @__PURE__ */ jsx5(
|
|
3482
|
+
"button",
|
|
3483
|
+
{
|
|
3484
|
+
type: "button",
|
|
3485
|
+
style: styles4.linkBtn,
|
|
3486
|
+
onClick: () => openResetPassword(row),
|
|
3487
|
+
children: "\u91CD\u7F6E\u5BC6\u7801"
|
|
3488
|
+
}
|
|
3489
|
+
),
|
|
3437
3490
|
/* @__PURE__ */ jsx5(
|
|
3438
3491
|
"button",
|
|
3439
3492
|
{
|
|
@@ -3500,20 +3553,26 @@ function UserManager({
|
|
|
3500
3553
|
/* @__PURE__ */ jsxs4("form", { style: styles4.form, onSubmit: (e) => void handleSubmit(e), children: [
|
|
3501
3554
|
formError ? /* @__PURE__ */ jsx5("div", { style: styles4.error, children: formError }) : null,
|
|
3502
3555
|
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3503
|
-
/* @__PURE__ */
|
|
3556
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3557
|
+
"\u8D26\u53F7 ",
|
|
3558
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3559
|
+
] }),
|
|
3504
3560
|
/* @__PURE__ */ jsx5(
|
|
3505
3561
|
"input",
|
|
3506
3562
|
{
|
|
3507
3563
|
style: styles4.input,
|
|
3508
3564
|
value: form.username,
|
|
3509
3565
|
onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
|
|
3510
|
-
placeholder: "\
|
|
3566
|
+
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",
|
|
3511
3567
|
required: true
|
|
3512
3568
|
}
|
|
3513
3569
|
)
|
|
3514
3570
|
] }),
|
|
3515
3571
|
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3516
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3573
|
+
"\u7528\u6237\u540D ",
|
|
3574
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3575
|
+
] }),
|
|
3517
3576
|
/* @__PURE__ */ jsx5(
|
|
3518
3577
|
"input",
|
|
3519
3578
|
{
|
|
@@ -3525,8 +3584,11 @@ function UserManager({
|
|
|
3525
3584
|
}
|
|
3526
3585
|
)
|
|
3527
3586
|
] }),
|
|
3528
|
-
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3529
|
-
/* @__PURE__ */
|
|
3587
|
+
!editing ? /* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3588
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3589
|
+
"\u521D\u59CB\u5BC6\u7801 ",
|
|
3590
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3591
|
+
] }),
|
|
3530
3592
|
/* @__PURE__ */ jsx5(
|
|
3531
3593
|
"input",
|
|
3532
3594
|
{
|
|
@@ -3534,12 +3596,12 @@ function UserManager({
|
|
|
3534
3596
|
type: "password",
|
|
3535
3597
|
value: form.password,
|
|
3536
3598
|
onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
|
|
3537
|
-
placeholder:
|
|
3538
|
-
required:
|
|
3599
|
+
placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
|
|
3600
|
+
required: true,
|
|
3539
3601
|
autoComplete: "new-password"
|
|
3540
3602
|
}
|
|
3541
3603
|
)
|
|
3542
|
-
] }),
|
|
3604
|
+
] }) : null,
|
|
3543
3605
|
/* @__PURE__ */ jsxs4("fieldset", { style: styles4.fieldset, children: [
|
|
3544
3606
|
/* @__PURE__ */ jsxs4("legend", { style: styles4.label, children: [
|
|
3545
3607
|
"\u5F52\u5C5E\u90E8\u95E8 ",
|
|
@@ -3682,6 +3744,68 @@ function UserManager({
|
|
|
3682
3744
|
] })
|
|
3683
3745
|
]
|
|
3684
3746
|
}
|
|
3747
|
+
) }) : null,
|
|
3748
|
+
resetRow ? /* @__PURE__ */ jsx5("div", { style: styles4.mask, onClick: closeResetDialog, children: /* @__PURE__ */ jsxs4(
|
|
3749
|
+
"div",
|
|
3750
|
+
{
|
|
3751
|
+
style: { ...styles4.dialog, maxWidth: 420 },
|
|
3752
|
+
onClick: (e) => e.stopPropagation(),
|
|
3753
|
+
role: "dialog",
|
|
3754
|
+
"aria-modal": "true",
|
|
3755
|
+
children: [
|
|
3756
|
+
/* @__PURE__ */ jsxs4("div", { style: styles4.dialogHeader, children: [
|
|
3757
|
+
/* @__PURE__ */ jsx5("h3", { style: styles4.dialogTitle, children: "\u91CD\u7F6E\u5BC6\u7801" }),
|
|
3758
|
+
/* @__PURE__ */ jsx5(
|
|
3759
|
+
"button",
|
|
3760
|
+
{
|
|
3761
|
+
type: "button",
|
|
3762
|
+
style: styles4.iconBtn,
|
|
3763
|
+
onClick: closeResetDialog,
|
|
3764
|
+
"aria-label": "\u5173\u95ED",
|
|
3765
|
+
children: "\xD7"
|
|
3766
|
+
}
|
|
3767
|
+
)
|
|
3768
|
+
] }),
|
|
3769
|
+
/* @__PURE__ */ jsxs4("form", { style: styles4.form, onSubmit: (e) => void confirmResetPassword(e), children: [
|
|
3770
|
+
resetError ? /* @__PURE__ */ jsx5("div", { style: styles4.error, children: resetError }) : null,
|
|
3771
|
+
/* @__PURE__ */ jsxs4("p", { style: styles4.confirmText, children: [
|
|
3772
|
+
"\u4E3A\u7528\u6237\u300C",
|
|
3773
|
+
/* @__PURE__ */ jsx5("strong", { children: resetRow.name }),
|
|
3774
|
+
"\u300D\uFF08",
|
|
3775
|
+
resetRow.username,
|
|
3776
|
+
"\uFF09\u8BBE\u7F6E\u65B0\u5BC6\u7801"
|
|
3777
|
+
] }),
|
|
3778
|
+
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3779
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.label, children: "\u65B0\u5BC6\u7801" }),
|
|
3780
|
+
/* @__PURE__ */ jsx5(
|
|
3781
|
+
"input",
|
|
3782
|
+
{
|
|
3783
|
+
style: styles4.input,
|
|
3784
|
+
type: "password",
|
|
3785
|
+
value: resetPassword,
|
|
3786
|
+
onChange: (e) => setResetPassword(e.target.value),
|
|
3787
|
+
placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",
|
|
3788
|
+
required: true,
|
|
3789
|
+
autoComplete: "new-password"
|
|
3790
|
+
}
|
|
3791
|
+
)
|
|
3792
|
+
] }),
|
|
3793
|
+
/* @__PURE__ */ jsxs4("div", { style: styles4.dialogFooter, children: [
|
|
3794
|
+
/* @__PURE__ */ jsx5(
|
|
3795
|
+
"button",
|
|
3796
|
+
{
|
|
3797
|
+
type: "button",
|
|
3798
|
+
style: styles4.secondaryBtn,
|
|
3799
|
+
onClick: closeResetDialog,
|
|
3800
|
+
disabled: resetting,
|
|
3801
|
+
children: "\u53D6\u6D88"
|
|
3802
|
+
}
|
|
3803
|
+
),
|
|
3804
|
+
/* @__PURE__ */ jsx5("button", { type: "submit", style: styles4.primaryBtn, disabled: resetting, children: resetting ? "\u63D0\u4EA4\u4E2D\u2026" : "\u786E\u8BA4\u91CD\u7F6E" })
|
|
3805
|
+
] })
|
|
3806
|
+
] })
|
|
3807
|
+
]
|
|
3808
|
+
}
|
|
3685
3809
|
) }) : null
|
|
3686
3810
|
] });
|
|
3687
3811
|
}
|