Support more special chars in password validating

This commit is contained in:
Yang Luo 2024-01-15 16:41:08 +08:00
parent d92b072ed0
commit 8227762988
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ var (
regexLowerCase = regexp.MustCompile(`[a-z]`) regexLowerCase = regexp.MustCompile(`[a-z]`)
regexUpperCase = regexp.MustCompile(`[A-Z]`) regexUpperCase = regexp.MustCompile(`[A-Z]`)
regexDigit = regexp.MustCompile(`\d`) regexDigit = regexp.MustCompile(`\d`)
regexSpecial = regexp.MustCompile(`[!@#$%^&*]`) regexSpecial = regexp.MustCompile("[!-/:-@[-`{-~]")
) )
func isValidOption_AtLeast6(password string) string { func isValidOption_AtLeast6(password string) string {

View File

@ -37,7 +37,7 @@ function isValidOption_Aa123(password) {
} }
function isValidOption_SpecialChar(password) { function isValidOption_SpecialChar(password) {
const regex = /^(?=.*[!@#$%^&*]).+$/; const regex = /^(?=.*[!-/:-@[-`{-~]).+$/;
if (!regex.test(password)) { if (!regex.test(password)) {
return i18next.t("user:The password must contain at least one special character"); return i18next.t("user:The password must contain at least one special character");
} }