Browse Source
Merge pull request #1053 from colinin/fix-use-settings
fix(hooks): 同步 useSettings 导出字段.
pull/1059/head
yx lin
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
16 deletions
-
apps/vben5/packages/@abp/identity/src/hooks/usePasswordValidator.ts
-
apps/vben5/packages/@abp/identity/src/hooks/useRandomPassword.ts
|
|
|
@ -13,8 +13,7 @@ import { |
|
|
|
} from '@abp/core'; |
|
|
|
|
|
|
|
export function usePasswordValidator() { |
|
|
|
const { settingProvider } = useSettings(); |
|
|
|
const { getNumber, isTrue } = settingProvider; |
|
|
|
const { getNumber, isTrue } = useSettings(); |
|
|
|
const { L } = useLocalization(['AbpIdentity', 'AbpUi']); |
|
|
|
|
|
|
|
const passwordSetting = computed(() => { |
|
|
|
|
|
|
|
@ -31,26 +31,18 @@ export function useRandomPassword() { |
|
|
|
} |
|
|
|
|
|
|
|
function generatePassword() { |
|
|
|
const { settingProvider } = useSettings(); |
|
|
|
const { getNumber, isTrue } = useSettings(); |
|
|
|
// 根据配置项生成随机密码
|
|
|
|
// 密码长度
|
|
|
|
const length = settingProvider.getNumber( |
|
|
|
'Abp.Identity.Password.RequiredLength', |
|
|
|
); |
|
|
|
const length = getNumber('Abp.Identity.Password.RequiredLength'); |
|
|
|
// 需要小写字母
|
|
|
|
const lower = settingProvider.isTrue( |
|
|
|
'Abp.Identity.Password.RequireLowercase', |
|
|
|
); |
|
|
|
const lower = isTrue('Abp.Identity.Password.RequireLowercase'); |
|
|
|
// 需要大写字母
|
|
|
|
const upper = settingProvider.isTrue( |
|
|
|
'Abp.Identity.Password.RequireUppercase', |
|
|
|
); |
|
|
|
const upper = isTrue('Abp.Identity.Password.RequireUppercase'); |
|
|
|
// 需要数字
|
|
|
|
const number = settingProvider.isTrue('Abp.Identity.Password.RequireDigit'); |
|
|
|
const number = isTrue('Abp.Identity.Password.RequireDigit'); |
|
|
|
// 需要符号
|
|
|
|
const symbol = settingProvider.isTrue( |
|
|
|
'Abp.Identity.Password.RequireNonAlphanumeric', |
|
|
|
); |
|
|
|
const symbol = isTrue('Abp.Identity.Password.RequireNonAlphanumeric'); |
|
|
|
// 默认生成数字
|
|
|
|
const defaultNumber = !lower && !upper && !number && !symbol; |
|
|
|
|
|
|
|
|