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.
@@ -2243,15 +2243,14 @@ var MenuManager = (0, import_vue4.defineComponent)({
2243
2243
  ]),
2244
2244
  dialogOpen.value ? (0, import_vue4.h)(
2245
2245
  "div",
2246
- { style: s2.mask, onClick: closeDialog },
2246
+ { style: s2.mask },
2247
2247
  [
2248
2248
  (0, import_vue4.h)(
2249
2249
  "div",
2250
2250
  {
2251
2251
  style: { ...s2.dialog, maxWidth: "520px" },
2252
2252
  role: "dialog",
2253
- "aria-modal": "true",
2254
- onClick: (e) => e.stopPropagation()
2253
+ "aria-modal": "true"
2255
2254
  },
2256
2255
  [
2257
2256
  (0, import_vue4.h)("div", { style: s2.dialogHeader }, [
@@ -2438,15 +2437,6 @@ var MenuManager = (0, import_vue4.defineComponent)({
2438
2437
  )
2439
2438
  ]),
2440
2439
  (0, import_vue4.h)("div", { style: s2.dialogFooter }, [
2441
- (0, import_vue4.h)(
2442
- "button",
2443
- {
2444
- type: "button",
2445
- style: s2.secondaryBtn,
2446
- onClick: closeDialog
2447
- },
2448
- "\u53D6\u6D88"
2449
- ),
2450
2440
  (0, import_vue4.h)(
2451
2441
  "button",
2452
2442
  {
@@ -3624,9 +3614,9 @@ function mapSystemRoleOption(item) {
3624
3614
  }
3625
3615
  function validateUsername(username) {
3626
3616
  const value = username.trim();
3627
- if (value.length < 6) return "\u8D26\u53F7\u957F\u5EA6\u4E0D\u5C11\u4E8E 6 \u4E2A\u5B57\u7B26";
3628
- if (!/[A-Za-z]/.test(value) || !/[0-9]/.test(value)) {
3629
- return "\u8D26\u53F7\u9700\u540C\u65F6\u5305\u542B\u5B57\u6BCD\u548C\u6570\u5B57";
3617
+ if (value.length <= 1) return "\u8D26\u53F7\u957F\u5EA6\u9700\u5927\u4E8E 1";
3618
+ if (!/^(?=.*[A-Za-z])[A-Za-z0-9]+$/.test(value)) {
3619
+ 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";
3630
3620
  }
3631
3621
  return null;
3632
3622
  }
@@ -3706,6 +3696,14 @@ function createSystemUserApi(request) {
3706
3696
  signal
3707
3697
  });
3708
3698
  },
3699
+ async resetPassword(userId, password, signal) {
3700
+ return request({
3701
+ method: "POST",
3702
+ url: `/system/users/${encodeURIComponent(userId)}/reset-password`,
3703
+ body: { password },
3704
+ signal
3705
+ });
3706
+ },
3709
3707
  async listGroups(params, signal) {
3710
3708
  const json = await request({
3711
3709
  method: "GET",
@@ -4057,6 +4055,10 @@ var UserManager = (0, import_vue6.defineComponent)({
4057
4055
  const saving = (0, import_vue6.ref)(false);
4058
4056
  const deletingRow = (0, import_vue6.ref)(null);
4059
4057
  const deleting = (0, import_vue6.ref)(false);
4058
+ const resetRow = (0, import_vue6.ref)(null);
4059
+ const resetPassword = (0, import_vue6.ref)("");
4060
+ const resetError = (0, import_vue6.ref)("");
4061
+ const resetting = (0, import_vue6.ref)(false);
4060
4062
  const groups = (0, import_vue6.ref)([]);
4061
4063
  const roles = (0, import_vue6.ref)([]);
4062
4064
  const rolesLoading = (0, import_vue6.ref)(false);
@@ -4217,6 +4219,38 @@ var UserManager = (0, import_vue6.defineComponent)({
4217
4219
  deleting.value = false;
4218
4220
  }
4219
4221
  }
4222
+ function openResetPassword(row) {
4223
+ resetRow.value = row;
4224
+ resetPassword.value = "";
4225
+ resetError.value = "";
4226
+ }
4227
+ function closeResetDialog() {
4228
+ if (!resetting.value) {
4229
+ resetRow.value = null;
4230
+ resetPassword.value = "";
4231
+ resetError.value = "";
4232
+ }
4233
+ }
4234
+ async function confirmResetPassword(event) {
4235
+ event.preventDefault();
4236
+ if (!resetRow.value) return;
4237
+ if (!resetPassword.value.trim()) {
4238
+ resetError.value = "\u8BF7\u586B\u5199\u65B0\u5BC6\u7801";
4239
+ return;
4240
+ }
4241
+ resetting.value = true;
4242
+ resetError.value = "";
4243
+ error.value = "";
4244
+ try {
4245
+ await props.api.resetPassword(resetRow.value.userId, resetPassword.value);
4246
+ resetRow.value = null;
4247
+ resetPassword.value = "";
4248
+ } catch (err) {
4249
+ resetError.value = err instanceof Error ? err.message : "\u91CD\u7F6E\u5BC6\u7801\u5931\u8D25";
4250
+ } finally {
4251
+ resetting.value = false;
4252
+ }
4253
+ }
4220
4254
  function groupLabel(row) {
4221
4255
  if (row.groupNames?.length) return row.groupNames.join("\u3001");
4222
4256
  if (!row.groupIds.length) return "\u2014";
@@ -4327,7 +4361,7 @@ var UserManager = (0, import_vue6.defineComponent)({
4327
4361
  (0, import_vue6.h)("th", { style: s4.th }, "\u5F52\u5C5E\u90E8\u95E8"),
4328
4362
  (0, import_vue6.h)("th", { style: s4.th }, "\u7528\u6237\u89D2\u8272"),
4329
4363
  (0, import_vue6.h)("th", { style: { ...s4.th, width: "90px" } }, "\u72B6\u6001"),
4330
- (0, import_vue6.h)("th", { style: { ...s4.th, width: "140px" } }, "\u64CD\u4F5C")
4364
+ (0, import_vue6.h)("th", { style: { ...s4.th, width: "220px" } }, "\u64CD\u4F5C")
4331
4365
  ])
4332
4366
  ]),
4333
4367
  (0, import_vue6.h)(
@@ -4368,6 +4402,15 @@ var UserManager = (0, import_vue6.defineComponent)({
4368
4402
  },
4369
4403
  "\u7F16\u8F91"
4370
4404
  ),
4405
+ (0, import_vue6.h)(
4406
+ "button",
4407
+ {
4408
+ type: "button",
4409
+ style: s4.linkBtn,
4410
+ onClick: () => openResetPassword(row)
4411
+ },
4412
+ "\u91CD\u7F6E\u5BC6\u7801"
4413
+ ),
4371
4414
  (0, import_vue6.h)(
4372
4415
  "button",
4373
4416
  {
@@ -4463,7 +4506,7 @@ var UserManager = (0, import_vue6.defineComponent)({
4463
4506
  (0, import_vue6.h)("input", {
4464
4507
  style: s4.input,
4465
4508
  value: form.username,
4466
- placeholder: "\u81F3\u5C116\u4F4D\uFF0C\u9700\u542B\u5B57\u6BCD\u548C\u6570\u5B57",
4509
+ 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",
4467
4510
  required: true,
4468
4511
  onInput: (e) => {
4469
4512
  form.username = e.target.value;
@@ -4682,6 +4725,84 @@ var UserManager = (0, import_vue6.defineComponent)({
4682
4725
  ])
4683
4726
  ]
4684
4727
  )
4728
+ ]) : null,
4729
+ resetRow.value ? (0, import_vue6.h)("div", { style: s4.mask, onClick: closeResetDialog }, [
4730
+ (0, import_vue6.h)(
4731
+ "div",
4732
+ {
4733
+ style: { ...s4.dialog, maxWidth: "420px" },
4734
+ role: "dialog",
4735
+ "aria-modal": "true",
4736
+ onClick: (e) => e.stopPropagation()
4737
+ },
4738
+ [
4739
+ (0, import_vue6.h)("div", { style: s4.dialogHeader }, [
4740
+ (0, import_vue6.h)("h3", { style: s4.dialogTitle }, "\u91CD\u7F6E\u5BC6\u7801"),
4741
+ (0, import_vue6.h)(
4742
+ "button",
4743
+ {
4744
+ type: "button",
4745
+ style: s4.iconBtn,
4746
+ "aria-label": "\u5173\u95ED",
4747
+ onClick: closeResetDialog
4748
+ },
4749
+ "\xD7"
4750
+ )
4751
+ ]),
4752
+ (0, import_vue6.h)(
4753
+ "form",
4754
+ {
4755
+ style: s4.form,
4756
+ onSubmit: (e) => void confirmResetPassword(e)
4757
+ },
4758
+ [
4759
+ resetError.value ? (0, import_vue6.h)("div", { style: s4.error }, resetError.value) : null,
4760
+ (0, import_vue6.h)("p", { style: s4.confirmText }, [
4761
+ "\u4E3A\u7528\u6237\u300C",
4762
+ (0, import_vue6.h)("strong", resetRow.value.name),
4763
+ "\u300D\uFF08",
4764
+ resetRow.value.username,
4765
+ "\uFF09\u8BBE\u7F6E\u65B0\u5BC6\u7801"
4766
+ ]),
4767
+ (0, import_vue6.h)("label", { style: s4.field }, [
4768
+ (0, import_vue6.h)("span", { style: s4.label }, "\u65B0\u5BC6\u7801"),
4769
+ (0, import_vue6.h)("input", {
4770
+ style: s4.input,
4771
+ type: "password",
4772
+ value: resetPassword.value,
4773
+ placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",
4774
+ required: true,
4775
+ autocomplete: "new-password",
4776
+ onInput: (e) => {
4777
+ resetPassword.value = e.target.value;
4778
+ }
4779
+ })
4780
+ ]),
4781
+ (0, import_vue6.h)("div", { style: s4.dialogFooter }, [
4782
+ (0, import_vue6.h)(
4783
+ "button",
4784
+ {
4785
+ type: "button",
4786
+ style: s4.secondaryBtn,
4787
+ disabled: resetting.value,
4788
+ onClick: closeResetDialog
4789
+ },
4790
+ "\u53D6\u6D88"
4791
+ ),
4792
+ (0, import_vue6.h)(
4793
+ "button",
4794
+ {
4795
+ type: "submit",
4796
+ style: s4.primaryBtn,
4797
+ disabled: resetting.value
4798
+ },
4799
+ resetting.value ? "\u63D0\u4EA4\u4E2D\u2026" : "\u786E\u8BA4\u91CD\u7F6E"
4800
+ )
4801
+ ])
4802
+ ]
4803
+ )
4804
+ ]
4805
+ )
4685
4806
  ]) : null
4686
4807
  ]);
4687
4808
  }