Преглед изворни кода

Email Validation - new pattern

@ included
mhsanaei пре 1 месец
родитељ
комит
3e7c7831bc
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      web/service/inbound.go

+ 2 - 2
web/service/inbound.go

@@ -2031,9 +2031,9 @@ func validateEmail(email string) (bool, error) {
 		return false, errors.New("email contains uppercase letters, please convert to lowercase")
 	}
 
-	emailPattern := `^[a-z0-9._-]+$`
+	emailPattern := `^[a-z0-9@._-]+$`
 	if !regexp.MustCompile(emailPattern).MatchString(email) {
-		return false, errors.New("email contains invalid characters, please use only lowercase letters, digits, dots, dashes, and underscores")
+		return false, errors.New("email contains invalid characters, please use only lowercase letters, digits, and @._-")
 	}
 
 	return true, nil