@abpjs/identity 1.0.0 → 1.1.0
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/dist/index.d.mts +17 -20
- package/dist/index.d.ts +17 -20
- package/dist/index.js +37 -12
- package/dist/index.mjs +37 -12
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -409,6 +409,11 @@ interface RolesComponentProps {
|
|
|
409
409
|
*/
|
|
410
410
|
declare function RolesComponent({ onRoleCreated, onRoleUpdated, onRoleDeleted, }: RolesComponentProps): React.ReactElement;
|
|
411
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Password rule type for validation display
|
|
414
|
+
* @since 1.1.0
|
|
415
|
+
*/
|
|
416
|
+
type PasswordRule = 'number' | 'small' | 'capital' | 'special';
|
|
412
417
|
/**
|
|
413
418
|
* Props for UsersComponent
|
|
414
419
|
*/
|
|
@@ -419,26 +424,18 @@ interface UsersComponentProps {
|
|
|
419
424
|
onUserUpdated?: (user: Identity.UserItem) => void;
|
|
420
425
|
/** Optional callback when a user is deleted */
|
|
421
426
|
onUserDeleted?: (id: string) => void;
|
|
427
|
+
/**
|
|
428
|
+
* Password validation rules to display
|
|
429
|
+
* @since 1.1.0
|
|
430
|
+
*/
|
|
431
|
+
passwordRulesArr?: PasswordRule[];
|
|
432
|
+
/**
|
|
433
|
+
* Required minimum password length
|
|
434
|
+
* @since 1.1.0
|
|
435
|
+
*/
|
|
436
|
+
requiredPasswordLength?: number;
|
|
422
437
|
}
|
|
423
|
-
|
|
424
|
-
* UsersComponent - Component for managing users
|
|
425
|
-
*
|
|
426
|
-
* This is the React equivalent of Angular's UsersComponent.
|
|
427
|
-
* It displays a table of users with CRUD operations, role assignment, and permission management.
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```tsx
|
|
431
|
-
* function IdentityPage() {
|
|
432
|
-
* return (
|
|
433
|
-
* <UsersComponent
|
|
434
|
-
* onUserCreated={(user) => console.log('User created:', user)}
|
|
435
|
-
* onUserDeleted={(id) => console.log('User deleted:', id)}
|
|
436
|
-
* />
|
|
437
|
-
* );
|
|
438
|
-
* }
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
|
-
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }: UsersComponentProps): React.ReactElement;
|
|
438
|
+
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, passwordRulesArr, requiredPasswordLength, }: UsersComponentProps): React.ReactElement;
|
|
442
439
|
|
|
443
440
|
/**
|
|
444
441
|
* Identity module routes configuration.
|
|
@@ -488,4 +485,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
488
485
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
489
486
|
};
|
|
490
487
|
|
|
491
|
-
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
|
488
|
+
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,11 @@ interface RolesComponentProps {
|
|
|
409
409
|
*/
|
|
410
410
|
declare function RolesComponent({ onRoleCreated, onRoleUpdated, onRoleDeleted, }: RolesComponentProps): React.ReactElement;
|
|
411
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Password rule type for validation display
|
|
414
|
+
* @since 1.1.0
|
|
415
|
+
*/
|
|
416
|
+
type PasswordRule = 'number' | 'small' | 'capital' | 'special';
|
|
412
417
|
/**
|
|
413
418
|
* Props for UsersComponent
|
|
414
419
|
*/
|
|
@@ -419,26 +424,18 @@ interface UsersComponentProps {
|
|
|
419
424
|
onUserUpdated?: (user: Identity.UserItem) => void;
|
|
420
425
|
/** Optional callback when a user is deleted */
|
|
421
426
|
onUserDeleted?: (id: string) => void;
|
|
427
|
+
/**
|
|
428
|
+
* Password validation rules to display
|
|
429
|
+
* @since 1.1.0
|
|
430
|
+
*/
|
|
431
|
+
passwordRulesArr?: PasswordRule[];
|
|
432
|
+
/**
|
|
433
|
+
* Required minimum password length
|
|
434
|
+
* @since 1.1.0
|
|
435
|
+
*/
|
|
436
|
+
requiredPasswordLength?: number;
|
|
422
437
|
}
|
|
423
|
-
|
|
424
|
-
* UsersComponent - Component for managing users
|
|
425
|
-
*
|
|
426
|
-
* This is the React equivalent of Angular's UsersComponent.
|
|
427
|
-
* It displays a table of users with CRUD operations, role assignment, and permission management.
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```tsx
|
|
431
|
-
* function IdentityPage() {
|
|
432
|
-
* return (
|
|
433
|
-
* <UsersComponent
|
|
434
|
-
* onUserCreated={(user) => console.log('User created:', user)}
|
|
435
|
-
* onUserDeleted={(id) => console.log('User deleted:', id)}
|
|
436
|
-
* />
|
|
437
|
-
* );
|
|
438
|
-
* }
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
|
-
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }: UsersComponentProps): React.ReactElement;
|
|
438
|
+
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, passwordRulesArr, requiredPasswordLength, }: UsersComponentProps): React.ReactElement;
|
|
442
439
|
|
|
443
440
|
/**
|
|
444
441
|
* Identity module routes configuration.
|
|
@@ -488,4 +485,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
488
485
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
489
486
|
};
|
|
490
487
|
|
|
491
|
-
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
|
488
|
+
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
package/dist/index.js
CHANGED
|
@@ -733,10 +733,26 @@ var DEFAULT_FORM_STATE2 = {
|
|
|
733
733
|
twoFactorEnabled: true,
|
|
734
734
|
roleNames: []
|
|
735
735
|
};
|
|
736
|
+
function getPasswordRuleLabel(rule, t) {
|
|
737
|
+
switch (rule) {
|
|
738
|
+
case "number":
|
|
739
|
+
return t("AbpIdentity::Password:RequireDigit");
|
|
740
|
+
case "small":
|
|
741
|
+
return t("AbpIdentity::Password:RequireLowercase");
|
|
742
|
+
case "capital":
|
|
743
|
+
return t("AbpIdentity::Password:RequireUppercase");
|
|
744
|
+
case "special":
|
|
745
|
+
return t("AbpIdentity::Password:RequireNonAlphanumeric");
|
|
746
|
+
default:
|
|
747
|
+
return rule;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
736
750
|
function UsersComponent({
|
|
737
751
|
onUserCreated,
|
|
738
752
|
onUserUpdated,
|
|
739
|
-
onUserDeleted
|
|
753
|
+
onUserDeleted,
|
|
754
|
+
passwordRulesArr = [],
|
|
755
|
+
requiredPasswordLength = 0
|
|
740
756
|
}) {
|
|
741
757
|
const { t } = (0, import_core4.useLocalization)();
|
|
742
758
|
const confirmation = (0, import_theme_shared2.useConfirmation)();
|
|
@@ -1032,17 +1048,26 @@ function UsersComponent({
|
|
|
1032
1048
|
}
|
|
1033
1049
|
) })
|
|
1034
1050
|
] }),
|
|
1035
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_theme_shared2.FormField, { label: t("AbpIdentity::Password"), required: !selectedUser?.id, children: [
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1053
|
+
import_react7.Input,
|
|
1054
|
+
{
|
|
1055
|
+
type: "password",
|
|
1056
|
+
value: formState.password,
|
|
1057
|
+
onChange: (e) => handleInputChange("password", e.target.value),
|
|
1058
|
+
autoComplete: "new-password",
|
|
1059
|
+
maxLength: 32,
|
|
1060
|
+
placeholder: selectedUser?.id ? t("AbpIdentity::LeaveBlankToKeepCurrent") : ""
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
(requiredPasswordLength > 0 || passwordRulesArr.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react7.Box, { mt: 2, fontSize: "sm", color: "gray.500", children: [
|
|
1064
|
+
requiredPasswordLength > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react7.Text, { children: t("AbpIdentity::Password:MinLength", String(requiredPasswordLength)) }),
|
|
1065
|
+
passwordRulesArr.map((rule) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react7.Text, { children: [
|
|
1066
|
+
"\u2022 ",
|
|
1067
|
+
getPasswordRuleLabel(rule, t)
|
|
1068
|
+
] }, rule))
|
|
1069
|
+
] })
|
|
1070
|
+
] }),
|
|
1046
1071
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_theme_shared2.FormField, { label: t("AbpIdentity::EmailAddress"), required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1047
1072
|
import_react7.Input,
|
|
1048
1073
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -719,10 +719,26 @@ var DEFAULT_FORM_STATE2 = {
|
|
|
719
719
|
twoFactorEnabled: true,
|
|
720
720
|
roleNames: []
|
|
721
721
|
};
|
|
722
|
+
function getPasswordRuleLabel(rule, t) {
|
|
723
|
+
switch (rule) {
|
|
724
|
+
case "number":
|
|
725
|
+
return t("AbpIdentity::Password:RequireDigit");
|
|
726
|
+
case "small":
|
|
727
|
+
return t("AbpIdentity::Password:RequireLowercase");
|
|
728
|
+
case "capital":
|
|
729
|
+
return t("AbpIdentity::Password:RequireUppercase");
|
|
730
|
+
case "special":
|
|
731
|
+
return t("AbpIdentity::Password:RequireNonAlphanumeric");
|
|
732
|
+
default:
|
|
733
|
+
return rule;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
722
736
|
function UsersComponent({
|
|
723
737
|
onUserCreated,
|
|
724
738
|
onUserUpdated,
|
|
725
|
-
onUserDeleted
|
|
739
|
+
onUserDeleted,
|
|
740
|
+
passwordRulesArr = [],
|
|
741
|
+
requiredPasswordLength = 0
|
|
726
742
|
}) {
|
|
727
743
|
const { t } = useLocalization2();
|
|
728
744
|
const confirmation = useConfirmation2();
|
|
@@ -1018,17 +1034,26 @@ function UsersComponent({
|
|
|
1018
1034
|
}
|
|
1019
1035
|
) })
|
|
1020
1036
|
] }),
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1037
|
+
/* @__PURE__ */ jsxs2(FormField2, { label: t("AbpIdentity::Password"), required: !selectedUser?.id, children: [
|
|
1038
|
+
/* @__PURE__ */ jsx2(
|
|
1039
|
+
Input2,
|
|
1040
|
+
{
|
|
1041
|
+
type: "password",
|
|
1042
|
+
value: formState.password,
|
|
1043
|
+
onChange: (e) => handleInputChange("password", e.target.value),
|
|
1044
|
+
autoComplete: "new-password",
|
|
1045
|
+
maxLength: 32,
|
|
1046
|
+
placeholder: selectedUser?.id ? t("AbpIdentity::LeaveBlankToKeepCurrent") : ""
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
(requiredPasswordLength > 0 || passwordRulesArr.length > 0) && /* @__PURE__ */ jsxs2(Box2, { mt: 2, fontSize: "sm", color: "gray.500", children: [
|
|
1050
|
+
requiredPasswordLength > 0 && /* @__PURE__ */ jsx2(Text2, { children: t("AbpIdentity::Password:MinLength", String(requiredPasswordLength)) }),
|
|
1051
|
+
passwordRulesArr.map((rule) => /* @__PURE__ */ jsxs2(Text2, { children: [
|
|
1052
|
+
"\u2022 ",
|
|
1053
|
+
getPasswordRuleLabel(rule, t)
|
|
1054
|
+
] }, rule))
|
|
1055
|
+
] })
|
|
1056
|
+
] }),
|
|
1032
1057
|
/* @__PURE__ */ jsx2(FormField2, { label: t("AbpIdentity::EmailAddress"), required: true, children: /* @__PURE__ */ jsx2(
|
|
1033
1058
|
Input2,
|
|
1034
1059
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/identity",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ABP Framework identity components for React - translated from @abp/ng.identity",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@chakra-ui/react": "^3.2.0",
|
|
27
27
|
"@emotion/react": "^11.11.0",
|
|
28
|
-
"@abpjs/core": "1.
|
|
29
|
-
"@abpjs/
|
|
30
|
-
"@abpjs/
|
|
28
|
+
"@abpjs/core": "1.1.0",
|
|
29
|
+
"@abpjs/permission-management": "1.1.0",
|
|
30
|
+
"@abpjs/theme-shared": "1.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@abp/ng.identity": "0.9.0",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
},
|
|
63
63
|
"repository": {
|
|
64
64
|
"type": "git",
|
|
65
|
-
"url": "https://github.com/abpjs/abp-react"
|
|
65
|
+
"url": "https://github.com/abpjs/abp-react",
|
|
66
|
+
"directory": "packages/identity"
|
|
66
67
|
},
|
|
67
68
|
"homepage": "https://docs.abpjs.io/docs/packages/identity/overview",
|
|
68
69
|
"bugs": {
|