From d31688e1ba5d9d074142af8ff2c9c454cf773548 Mon Sep 17 00:00:00 2001 From: bagas Date: Tue, 3 Sep 2024 13:46:28 +0700 Subject: [PATCH] Fix password validation issue during registration --- utils/utils.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 197da33..fd8b1e1 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -66,25 +66,25 @@ func CheckPasswordHash(password, hash string) bool { } func ValidatePassword(password string) bool { - if len(password) < 6 { + if len(password) < 8 { return false } var ( - hasNumber int + hasNumber bool hasUppercase bool ) for _, char := range password { switch { case unicode.IsNumber(char): - hasNumber++ + hasNumber = true case unicode.IsUpper(char): hasUppercase = true } } - return hasNumber >= 3 && hasUppercase + return hasNumber && hasUppercase } func ConvertFileSize(byte int64) string {