[fix] Add allowed symbols for password; Fix bug 77233

This commit is contained in:
PauI Ostrovckij
2025-10-31 19:11:06 +03:00
parent 5af7e20090
commit 9343be675f
5 changed files with 16 additions and 4 deletions

View File

@ -30,7 +30,8 @@ function PasswordRequirements({password, isVisible = false}) {
{key: 'minLength', format: 'passlength'},
{key: 'hasDigit', format: 'passdigit'},
{key: 'hasUppercase', format: 'passupper'},
{key: 'hasSpecialChar', format: 'passspecial'}
{key: 'hasSpecialChar', format: 'passspecial'},
{key: 'allowedCharactersOnly', format: 'passallowedchars'}
];
const invalidRulesSet = new Set(invalidRules);

View File

@ -52,7 +52,7 @@
.requirementItem {
display: flex;
align-items: center;
// align-items: center;
margin-bottom: 4px;
font-size: 10px;
line-height: 1.4;

View File

@ -10,7 +10,7 @@ export function usePasswordValidation(password) {
const {validateField, isLoading} = useFieldValidation();
const validationResult = useMemo(() => {
const rules = ['minLength', 'hasDigit', 'hasUppercase', 'hasSpecialChar'];
const rules = ['minLength', 'hasDigit', 'hasUppercase', 'hasSpecialChar', 'allowedCharactersOnly'];
const invalidRules = rules.filter(rule => {
const fieldPath = `adminPanel.passwordValidation.${rule}`;

View File

@ -29,7 +29,8 @@ function validatePassword(ctx, password) {
minLength: password,
hasDigit: password,
hasUppercase: password,
hasSpecialChar: password
hasSpecialChar: password,
allowedCharactersOnly: password
}
}
};

View File

@ -26,6 +26,11 @@
"passspecial": {
"type": "string",
"pattern": ".*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?].*"
},
"passallowedchars": {
"type": "string",
"pattern": "^[A-Za-z0-9!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?]+$",
"errorMessage": "contain only uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and special characters"
}
},
"properties": {
@ -447,6 +452,11 @@
"$ref": "#/$defs/passspecial",
"description": "contain at least one special character",
"x-scope": ["admin", "tenant"]
},
"allowedCharactersOnly": {
"$ref": "#/$defs/passallowedchars",
"description": "contain only uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and special characters (e.g., ! @ # $ % & *)",
"x-scope": ["admin", "tenant"]
}
}
}