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.
@@ -3614,9 +3614,9 @@ function mapSystemRoleOption(item) {
3614
3614
  }
3615
3615
  function validateUsername(username) {
3616
3616
  const value = username.trim();
3617
- if (value.length < 6) return "\u8D26\u53F7\u957F\u5EA6\u4E0D\u5C11\u4E8E 6 \u4E2A\u5B57\u7B26";
3618
- if (!/[A-Za-z]/.test(value) || !/[0-9]/.test(value)) {
3619
- 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";
3620
3620
  }
3621
3621
  return null;
3622
3622
  }
@@ -3696,6 +3696,14 @@ function createSystemUserApi(request) {
3696
3696
  signal
3697
3697
  });
3698
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
+ },
3699
3707
  async listGroups(params, signal) {
3700
3708
  const json = await request({
3701
3709
  method: "GET",
@@ -4047,6 +4055,10 @@ var UserManager = (0, import_vue6.defineComponent)({
4047
4055
  const saving = (0, import_vue6.ref)(false);
4048
4056
  const deletingRow = (0, import_vue6.ref)(null);
4049
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);
4050
4062
  const groups = (0, import_vue6.ref)([]);
4051
4063
  const roles = (0, import_vue6.ref)([]);
4052
4064
  const rolesLoading = (0, import_vue6.ref)(false);
@@ -4207,6 +4219,38 @@ var UserManager = (0, import_vue6.defineComponent)({
4207
4219
  deleting.value = false;
4208
4220
  }
4209
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
+ }
4210
4254
  function groupLabel(row) {
4211
4255
  if (row.groupNames?.length) return row.groupNames.join("\u3001");
4212
4256
  if (!row.groupIds.length) return "\u2014";
@@ -4317,7 +4361,7 @@ var UserManager = (0, import_vue6.defineComponent)({
4317
4361
  (0, import_vue6.h)("th", { style: s4.th }, "\u5F52\u5C5E\u90E8\u95E8"),
4318
4362
  (0, import_vue6.h)("th", { style: s4.th }, "\u7528\u6237\u89D2\u8272"),
4319
4363
  (0, import_vue6.h)("th", { style: { ...s4.th, width: "90px" } }, "\u72B6\u6001"),
4320
- (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")
4321
4365
  ])
4322
4366
  ]),
4323
4367
  (0, import_vue6.h)(
@@ -4358,6 +4402,15 @@ var UserManager = (0, import_vue6.defineComponent)({
4358
4402
  },
4359
4403
  "\u7F16\u8F91"
4360
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
+ ),
4361
4414
  (0, import_vue6.h)(
4362
4415
  "button",
4363
4416
  {
@@ -4449,11 +4502,14 @@ var UserManager = (0, import_vue6.defineComponent)({
4449
4502
  [
4450
4503
  formError.value ? (0, import_vue6.h)("div", { style: s4.error }, formError.value) : null,
4451
4504
  (0, import_vue6.h)("label", { style: s4.field }, [
4452
- (0, import_vue6.h)("span", { style: s4.label }, "\u8D26\u53F7"),
4505
+ (0, import_vue6.h)("span", { style: s4.label }, [
4506
+ "\u8D26\u53F7 ",
4507
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4508
+ ]),
4453
4509
  (0, import_vue6.h)("input", {
4454
4510
  style: s4.input,
4455
4511
  value: form.username,
4456
- placeholder: "\u81F3\u5C116\u4F4D\uFF0C\u9700\u542B\u5B57\u6BCD\u548C\u6570\u5B57",
4512
+ 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",
4457
4513
  required: true,
4458
4514
  onInput: (e) => {
4459
4515
  form.username = e.target.value;
@@ -4461,7 +4517,10 @@ var UserManager = (0, import_vue6.defineComponent)({
4461
4517
  })
4462
4518
  ]),
4463
4519
  (0, import_vue6.h)("label", { style: s4.field }, [
4464
- (0, import_vue6.h)("span", { style: s4.label }, "\u7528\u6237\u540D"),
4520
+ (0, import_vue6.h)("span", { style: s4.label }, [
4521
+ "\u7528\u6237\u540D ",
4522
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4523
+ ]),
4465
4524
  (0, import_vue6.h)("input", {
4466
4525
  style: s4.input,
4467
4526
  value: form.name,
@@ -4472,24 +4531,23 @@ var UserManager = (0, import_vue6.defineComponent)({
4472
4531
  }
4473
4532
  })
4474
4533
  ]),
4475
- (0, import_vue6.h)("label", { style: s4.field }, [
4476
- (0, import_vue6.h)(
4477
- "span",
4478
- { style: s4.label },
4479
- editing.value ? "\u5BC6\u7801\uFF08\u7559\u7A7A\u5219\u4E0D\u4FEE\u6539\uFF09" : "\u521D\u59CB\u5BC6\u7801"
4480
- ),
4534
+ !editing.value ? (0, import_vue6.h)("label", { style: s4.field }, [
4535
+ (0, import_vue6.h)("span", { style: s4.label }, [
4536
+ "\u521D\u59CB\u5BC6\u7801 ",
4537
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4538
+ ]),
4481
4539
  (0, import_vue6.h)("input", {
4482
4540
  style: s4.input,
4483
4541
  type: "password",
4484
4542
  value: form.password,
4485
- placeholder: editing.value ? "\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539\u5BC6\u7801" : "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
4486
- required: !editing.value,
4543
+ placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
4544
+ required: true,
4487
4545
  autocomplete: "new-password",
4488
4546
  onInput: (e) => {
4489
4547
  form.password = e.target.value;
4490
4548
  }
4491
4549
  })
4492
- ]),
4550
+ ]) : null,
4493
4551
  (0, import_vue6.h)("fieldset", { style: s4.fieldset }, [
4494
4552
  (0, import_vue6.h)("legend", { style: s4.label }, [
4495
4553
  "\u5F52\u5C5E\u90E8\u95E8 ",
@@ -4672,6 +4730,84 @@ var UserManager = (0, import_vue6.defineComponent)({
4672
4730
  ])
4673
4731
  ]
4674
4732
  )
4733
+ ]) : null,
4734
+ resetRow.value ? (0, import_vue6.h)("div", { style: s4.mask, onClick: closeResetDialog }, [
4735
+ (0, import_vue6.h)(
4736
+ "div",
4737
+ {
4738
+ style: { ...s4.dialog, maxWidth: "420px" },
4739
+ role: "dialog",
4740
+ "aria-modal": "true",
4741
+ onClick: (e) => e.stopPropagation()
4742
+ },
4743
+ [
4744
+ (0, import_vue6.h)("div", { style: s4.dialogHeader }, [
4745
+ (0, import_vue6.h)("h3", { style: s4.dialogTitle }, "\u91CD\u7F6E\u5BC6\u7801"),
4746
+ (0, import_vue6.h)(
4747
+ "button",
4748
+ {
4749
+ type: "button",
4750
+ style: s4.iconBtn,
4751
+ "aria-label": "\u5173\u95ED",
4752
+ onClick: closeResetDialog
4753
+ },
4754
+ "\xD7"
4755
+ )
4756
+ ]),
4757
+ (0, import_vue6.h)(
4758
+ "form",
4759
+ {
4760
+ style: s4.form,
4761
+ onSubmit: (e) => void confirmResetPassword(e)
4762
+ },
4763
+ [
4764
+ resetError.value ? (0, import_vue6.h)("div", { style: s4.error }, resetError.value) : null,
4765
+ (0, import_vue6.h)("p", { style: s4.confirmText }, [
4766
+ "\u4E3A\u7528\u6237\u300C",
4767
+ (0, import_vue6.h)("strong", resetRow.value.name),
4768
+ "\u300D\uFF08",
4769
+ resetRow.value.username,
4770
+ "\uFF09\u8BBE\u7F6E\u65B0\u5BC6\u7801"
4771
+ ]),
4772
+ (0, import_vue6.h)("label", { style: s4.field }, [
4773
+ (0, import_vue6.h)("span", { style: s4.label }, "\u65B0\u5BC6\u7801"),
4774
+ (0, import_vue6.h)("input", {
4775
+ style: s4.input,
4776
+ type: "password",
4777
+ value: resetPassword.value,
4778
+ placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",
4779
+ required: true,
4780
+ autocomplete: "new-password",
4781
+ onInput: (e) => {
4782
+ resetPassword.value = e.target.value;
4783
+ }
4784
+ })
4785
+ ]),
4786
+ (0, import_vue6.h)("div", { style: s4.dialogFooter }, [
4787
+ (0, import_vue6.h)(
4788
+ "button",
4789
+ {
4790
+ type: "button",
4791
+ style: s4.secondaryBtn,
4792
+ disabled: resetting.value,
4793
+ onClick: closeResetDialog
4794
+ },
4795
+ "\u53D6\u6D88"
4796
+ ),
4797
+ (0, import_vue6.h)(
4798
+ "button",
4799
+ {
4800
+ type: "submit",
4801
+ style: s4.primaryBtn,
4802
+ disabled: resetting.value
4803
+ },
4804
+ resetting.value ? "\u63D0\u4EA4\u4E2D\u2026" : "\u786E\u8BA4\u91CD\u7F6E"
4805
+ )
4806
+ ])
4807
+ ]
4808
+ )
4809
+ ]
4810
+ )
4675
4811
  ]) : null
4676
4812
  ]);
4677
4813
  }