@liujitcn/kratos-admin-core 0.1.1 → 0.1.4

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.
@@ -0,0 +1,11 @@
1
+ import type { AccountService, CurrentPasswordPolicy, GetCurrentPasswordPolicyRequest, UpdateUserPasswordRequest } from "../../../rpc/base/v1/account";
2
+ import type { Empty } from "../../../rpc/google/protobuf/empty";
3
+ /** AccountService 账户安全公共服务。 */
4
+ export declare class AccountServiceImpl implements AccountService {
5
+ /** 获取当前用户生效的密码策略。 */
6
+ GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
7
+ /** 修改当前用户密码。 */
8
+ UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty>;
9
+ }
10
+ /** 当前用户账户安全公共服务实例。 */
11
+ export declare const defAccountService: AccountServiceImpl;
@@ -1,9 +1,7 @@
1
- import type { CurrentPasswordPolicy, GetCurrentPasswordPolicyRequest, GetUserInfoRequest, ListUserButtonRequest, TreeRouteResponse, TreeUserMenuRequest, UserInfoForm } from "../../../../rpc/system/admin/v1/auth";
1
+ import type { GetUserInfoRequest, ListUserButtonRequest, TreeRouteResponse, TreeUserMenuRequest, UserInfoForm } from "../../../../rpc/system/admin/v1/auth";
2
2
  import type { StringValues } from "../../../../rpc/common/v1/types";
3
3
  /** AuthServiceImpl 管理端运行壳认证服务。 */
4
4
  export declare class AuthServiceImpl {
5
- /** 获取当前用户生效的密码策略。 */
6
- GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
7
5
  /** 获取当前登录用户。 */
8
6
  GetUserInfo(request: GetUserInfoRequest): Promise<UserInfoForm>;
9
7
  /** 获取当前用户菜单。 */
@@ -1,4 +1,4 @@
1
- import type { CurrentPasswordPolicy } from "../../rpc/system/admin/v1/auth";
1
+ import type { CurrentPasswordPolicy } from "../../rpc/base/v1/account";
2
2
  /** 密码强度组件属性。 */
3
3
  interface PasswordStrengthProps {
4
4
  /** 当前密码值。 */
@@ -0,0 +1,35 @@
1
+ import type { SecretCrypto } from "../../common/v1/types";
2
+ import type { Empty } from "../../google/protobuf/empty";
3
+ /** 获取当前用户密码策略请求参数。 */
4
+ export interface GetCurrentPasswordPolicyRequest {
5
+ }
6
+ /** 当前用户生效的密码策略。 */
7
+ export interface CurrentPasswordPolicy {
8
+ /** 密码最小长度 */
9
+ min_length: number;
10
+ /** 密码至少满足的字符类别数量 */
11
+ min_complexity_classes: number;
12
+ /** 禁止重复使用的历史密码数量 */
13
+ history_count: number;
14
+ /** 密码有效期天数 */
15
+ max_age_days: number;
16
+ }
17
+ /** 更新当前用户密码请求参数。 */
18
+ export interface UpdateUserPasswordRequest {
19
+ /** 当前用户密码 */
20
+ user_password: UserPasswordForm | undefined;
21
+ }
22
+ /** 当前用户密码表单。 */
23
+ export interface UserPasswordForm {
24
+ /** 原密码 */
25
+ old_pwd: SecretCrypto | undefined;
26
+ /** 新密码 */
27
+ new_pwd: SecretCrypto | undefined;
28
+ }
29
+ /** Base 账户安全服务。 */
30
+ export interface AccountService {
31
+ /** 获取当前用户生效的密码策略。 */
32
+ GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
33
+ /** 修改当前用户密码。 */
34
+ UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty>;
35
+ }
@@ -1,4 +1,4 @@
1
- import type { SecretCrypto, StringValues } from "../../../common/v1/types";
1
+ import type { StringValues } from "../../../common/v1/types";
2
2
  import type { Empty } from "../../../google/protobuf/empty";
3
3
  import type { BaseUserIDType } from "../../common/v1/common";
4
4
  import type { BaseMenuType } from "./common";
@@ -48,20 +48,6 @@ export interface UserInfoForm {
48
48
  /** 获取个人中心用户信息请求参数 */
49
49
  export interface GetUserProfileRequest {
50
50
  }
51
- /** 获取当前用户密码策略请求参数 */
52
- export interface GetCurrentPasswordPolicyRequest {
53
- }
54
- /** 当前用户生效的密码策略 */
55
- export interface CurrentPasswordPolicy {
56
- /** 密码最小长度 */
57
- min_length: number;
58
- /** 密码至少满足的字符类别数量 */
59
- min_complexity_classes: number;
60
- /** 禁止重复使用的历史密码数量,零表示不启用 */
61
- history_count: number;
62
- /** 密码有效期天数,零表示长期有效 */
63
- max_age_days: number;
64
- }
65
51
  /** 用户资料表单 */
66
52
  export interface UserProfileForm {
67
53
  /** 用户名 */
@@ -87,11 +73,6 @@ export interface UserProfileForm {
87
73
  /** 创建时间 */
88
74
  created_at: string;
89
75
  }
90
- /** 更新个人中心密码请求参数 */
91
- export interface UpdateUserPasswordRequest {
92
- /** 个人中心密码 */
93
- user_password: UserPasswordForm | undefined;
94
- }
95
76
  /** 更新个人中心手机号请求参数 */
96
77
  export interface UpdateUserPhoneRequest {
97
78
  /** 个人中心手机号 */
@@ -150,13 +131,6 @@ export interface RouteParams {
150
131
  /** value */
151
132
  value?: string | undefined;
152
133
  }
153
- /** 用户密码表单 */
154
- export interface UserPasswordForm {
155
- /** 原密码 */
156
- old_pwd: SecretCrypto | undefined;
157
- /** 新密码 */
158
- new_pwd: SecretCrypto | undefined;
159
- }
160
134
  /** 用户手机号表单 */
161
135
  export interface UserPhoneForm {
162
136
  /** 手机号 */
@@ -174,10 +148,6 @@ export interface AuthService {
174
148
  GetUserInfo(request: GetUserInfoRequest): Promise<UserInfoForm>;
175
149
  /** 获取个人中心用户信息 */
176
150
  GetUserProfile(request: GetUserProfileRequest): Promise<UserProfileForm>;
177
- /** 获取当前用户生效的密码策略 */
178
- GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
179
- /** 修改个人中心密码 */
180
- UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty>;
181
151
  /** 修改个人中心手机号 */
182
152
  UpdateUserPhone(request: UpdateUserPhoneRequest): Promise<Empty>;
183
153
  /** 修改个人中心用户信息 */
@@ -0,0 +1,34 @@
1
+ import service from "../../../utils/request";
2
+ import type {
3
+ AccountService,
4
+ CurrentPasswordPolicy,
5
+ GetCurrentPasswordPolicyRequest,
6
+ UpdateUserPasswordRequest
7
+ } from "../../../rpc/base/v1/account";
8
+ import type { Empty } from "../../../rpc/google/protobuf/empty";
9
+
10
+ const ACCOUNT_URL = "/v1/base/account";
11
+
12
+ /** AccountService 账户安全公共服务。 */
13
+ export class AccountServiceImpl implements AccountService {
14
+ /** 获取当前用户生效的密码策略。 */
15
+ GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy> {
16
+ return service<GetCurrentPasswordPolicyRequest, CurrentPasswordPolicy>({
17
+ url: `${ACCOUNT_URL}/password-policy`,
18
+ method: "get",
19
+ params: request
20
+ });
21
+ }
22
+
23
+ /** 修改当前用户密码。 */
24
+ UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty> {
25
+ return service<UpdateUserPasswordRequest["user_password"], Empty>({
26
+ url: `${ACCOUNT_URL}/password`,
27
+ method: "put",
28
+ data: request.user_password
29
+ });
30
+ }
31
+ }
32
+
33
+ /** 当前用户账户安全公共服务实例。 */
34
+ export const defAccountService = new AccountServiceImpl();
@@ -1,7 +1,5 @@
1
1
  import service from "../../../../utils/request";
2
2
  import type {
3
- CurrentPasswordPolicy,
4
- GetCurrentPasswordPolicyRequest,
5
3
  GetUserInfoRequest,
6
4
  ListUserButtonRequest,
7
5
  TreeRouteResponse,
@@ -14,15 +12,6 @@ const AUTH_URL = "/v1/admin/auth";
14
12
 
15
13
  /** AuthServiceImpl 管理端运行壳认证服务。 */
16
14
  export class AuthServiceImpl {
17
- /** 获取当前用户生效的密码策略。 */
18
- GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy> {
19
- return service<GetCurrentPasswordPolicyRequest, CurrentPasswordPolicy>({
20
- url: `${AUTH_URL}/password-policy`,
21
- method: "get",
22
- params: request
23
- });
24
- }
25
-
26
15
  /** 获取当前登录用户。 */
27
16
  GetUserInfo(request: GetUserInfoRequest): Promise<UserInfoForm> {
28
17
  return service<GetUserInfoRequest, UserInfoForm>({
@@ -23,8 +23,8 @@
23
23
 
24
24
  <script setup lang="ts">
25
25
  import { computed, onMounted, ref } from "vue";
26
- import { defAuthService } from "../../api/system/admin/v1/auth";
27
- import type { CurrentPasswordPolicy } from "../../rpc/system/admin/v1/auth";
26
+ import { defAccountService } from "../../api/base/v1/account";
27
+ import type { CurrentPasswordPolicy } from "../../rpc/base/v1/account";
28
28
  import { getPasswordStrength } from "../../utils/passwordStrength";
29
29
  import { useLocaleStore } from "../../locales";
30
30
 
@@ -82,7 +82,7 @@ const displayedTip = computed(() => {
82
82
  onMounted(async () => {
83
83
  if (!props.loadCurrentPolicy || props.policy) return;
84
84
  try {
85
- currentPolicy.value = await defAuthService.GetCurrentPasswordPolicy({});
85
+ currentPolicy.value = await defAccountService.GetCurrentPasswordPolicy({});
86
86
  } catch (_error) {
87
87
  currentPolicy.value = undefined;
88
88
  }
@@ -0,0 +1,49 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.1
4
+ // protoc unknown
5
+ // source: base/v1/account.proto
6
+
7
+ /* eslint-disable */
8
+ import type { SecretCrypto } from "../../common/v1/types";
9
+ import type { Empty } from "../../google/protobuf/empty";
10
+
11
+ /** 获取当前用户密码策略请求参数。 */
12
+ export interface GetCurrentPasswordPolicyRequest {
13
+ }
14
+
15
+ /** 当前用户生效的密码策略。 */
16
+ export interface CurrentPasswordPolicy {
17
+ /** 密码最小长度 */
18
+ min_length: number;
19
+ /** 密码至少满足的字符类别数量 */
20
+ min_complexity_classes: number;
21
+ /** 禁止重复使用的历史密码数量 */
22
+ history_count: number;
23
+ /** 密码有效期天数 */
24
+ max_age_days: number;
25
+ }
26
+
27
+ /** 更新当前用户密码请求参数。 */
28
+ export interface UpdateUserPasswordRequest {
29
+ /** 当前用户密码 */
30
+ user_password: UserPasswordForm | undefined;
31
+ }
32
+
33
+ /** 当前用户密码表单。 */
34
+ export interface UserPasswordForm {
35
+ /** 原密码 */
36
+ old_pwd:
37
+ | SecretCrypto
38
+ | undefined;
39
+ /** 新密码 */
40
+ new_pwd: SecretCrypto | undefined;
41
+ }
42
+
43
+ /** Base 账户安全服务。 */
44
+ export interface AccountService {
45
+ /** 获取当前用户生效的密码策略。 */
46
+ GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
47
+ /** 修改当前用户密码。 */
48
+ UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty>;
49
+ }
@@ -5,7 +5,7 @@
5
5
  // source: system/admin/v1/auth.proto
6
6
 
7
7
  /* eslint-disable */
8
- import type { SecretCrypto, StringValues } from "../../../common/v1/types";
8
+ import type { StringValues } from "../../../common/v1/types";
9
9
  import type { Empty } from "../../../google/protobuf/empty";
10
10
  import type { BaseUserIDType } from "../../common/v1/common";
11
11
  import type { BaseMenuType } from "./common";
@@ -62,22 +62,6 @@ export interface UserInfoForm {
62
62
  export interface GetUserProfileRequest {
63
63
  }
64
64
 
65
- /** 获取当前用户密码策略请求参数 */
66
- export interface GetCurrentPasswordPolicyRequest {
67
- }
68
-
69
- /** 当前用户生效的密码策略 */
70
- export interface CurrentPasswordPolicy {
71
- /** 密码最小长度 */
72
- min_length: number;
73
- /** 密码至少满足的字符类别数量 */
74
- min_complexity_classes: number;
75
- /** 禁止重复使用的历史密码数量,零表示不启用 */
76
- history_count: number;
77
- /** 密码有效期天数,零表示长期有效 */
78
- max_age_days: number;
79
- }
80
-
81
65
  /** 用户资料表单 */
82
66
  export interface UserProfileForm {
83
67
  /** 用户名 */
@@ -104,12 +88,6 @@ export interface UserProfileForm {
104
88
  created_at: string;
105
89
  }
106
90
 
107
- /** 更新个人中心密码请求参数 */
108
- export interface UpdateUserPasswordRequest {
109
- /** 个人中心密码 */
110
- user_password: UserPasswordForm | undefined;
111
- }
112
-
113
91
  /** 更新个人中心手机号请求参数 */
114
92
  export interface UpdateUserPhoneRequest {
115
93
  /** 个人中心手机号 */
@@ -200,16 +178,6 @@ export interface RouteParams {
200
178
  value?: string | undefined;
201
179
  }
202
180
 
203
- /** 用户密码表单 */
204
- export interface UserPasswordForm {
205
- /** 原密码 */
206
- old_pwd:
207
- | SecretCrypto
208
- | undefined;
209
- /** 新密码 */
210
- new_pwd: SecretCrypto | undefined;
211
- }
212
-
213
181
  /** 用户手机号表单 */
214
182
  export interface UserPhoneForm {
215
183
  /** 手机号 */
@@ -228,10 +196,6 @@ export interface AuthService {
228
196
  GetUserInfo(request: GetUserInfoRequest): Promise<UserInfoForm>;
229
197
  /** 获取个人中心用户信息 */
230
198
  GetUserProfile(request: GetUserProfileRequest): Promise<UserProfileForm>;
231
- /** 获取当前用户生效的密码策略 */
232
- GetCurrentPasswordPolicy(request: GetCurrentPasswordPolicyRequest): Promise<CurrentPasswordPolicy>;
233
- /** 修改个人中心密码 */
234
- UpdateUserPassword(request: UpdateUserPasswordRequest): Promise<Empty>;
235
199
  /** 修改个人中心手机号 */
236
200
  UpdateUserPhone(request: UpdateUserPhoneRequest): Promise<Empty>;
237
201
  /** 修改个人中心用户信息 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liujitcn/kratos-admin-core",
3
3
  "private": false,
4
- "version": "0.1.1",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "description": "kratos-admin frontend runtime and base modules",
7
7
  "author": {