com-angel-authorization 1.0.30 → 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.
@@ -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
  {
@@ -4453,7 +4506,7 @@ var UserManager = (0, import_vue6.defineComponent)({
4453
4506
  (0, import_vue6.h)("input", {
4454
4507
  style: s4.input,
4455
4508
  value: form.username,
4456
- 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",
4457
4510
  required: true,
4458
4511
  onInput: (e) => {
4459
4512
  form.username = e.target.value;
@@ -4672,6 +4725,84 @@ var UserManager = (0, import_vue6.defineComponent)({
4672
4725
  ])
4673
4726
  ]
4674
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
+ )
4675
4806
  ]) : null
4676
4807
  ]);
4677
4808
  }