From 8227762988cc98bed1d87b6453cda765b8a153e9 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Mon, 15 Jan 2024 16:41:08 +0800 Subject: [PATCH] Support more special chars in password validating --- object/check_password_complexity.go | 2 +- web/src/common/PasswordChecker.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/object/check_password_complexity.go b/object/check_password_complexity.go index 859b690a..6e7829c4 100644 --- a/object/check_password_complexity.go +++ b/object/check_password_complexity.go @@ -24,7 +24,7 @@ var ( regexLowerCase = regexp.MustCompile(`[a-z]`) regexUpperCase = regexp.MustCompile(`[A-Z]`) regexDigit = regexp.MustCompile(`\d`) - regexSpecial = regexp.MustCompile(`[!@#$%^&*]`) + regexSpecial = regexp.MustCompile("[!-/:-@[-`{-~]") ) func isValidOption_AtLeast6(password string) string { diff --git a/web/src/common/PasswordChecker.js b/web/src/common/PasswordChecker.js index fcb7fd74..72b46c38 100644 --- a/web/src/common/PasswordChecker.js +++ b/web/src/common/PasswordChecker.js @@ -37,7 +37,7 @@ function isValidOption_Aa123(password) { } function isValidOption_SpecialChar(password) { - const regex = /^(?=.*[!@#$%^&*]).+$/; + const regex = /^(?=.*[!-/:-@[-`{-~]).+$/; if (!regex.test(password)) { return i18next.t("user:The password must contain at least one special character"); }