mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[fix] Add allowed symbols for password; Fix bug 77233
This commit is contained in:
@ -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);
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
.requirementItem {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// align-items: center;
|
||||
margin-bottom: 4px;
|
||||
font-size: 10px;
|
||||
line-height: 1.4;
|
||||
|
||||
@ -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}`;
|
||||
|
||||
@ -29,7 +29,8 @@ function validatePassword(ctx, password) {
|
||||
minLength: password,
|
||||
hasDigit: password,
|
||||
hasUppercase: password,
|
||||
hasSpecialChar: password
|
||||
hasSpecialChar: password,
|
||||
allowedCharactersOnly: password
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user