mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-03-01 01:20:49 +03:00
validate Email - non-English Pattern
This commit is contained in:
parent
dcab4e6f9c
commit
4f2f855c04
@ -2024,6 +2024,7 @@ func (s *InboundService) GetOnlineClients() []string {
|
||||
}
|
||||
|
||||
func validateEmail(email string) (bool, error) {
|
||||
|
||||
if strings.Contains(email, " ") {
|
||||
return false, errors.New("email contains spaces, please remove them")
|
||||
}
|
||||
@ -2032,6 +2033,11 @@ func validateEmail(email string) (bool, error) {
|
||||
return false, errors.New("email contains uppercase letters, please convert to lowercase")
|
||||
}
|
||||
|
||||
nonEnglishPattern := `[^\x00-\x7F]`
|
||||
if regexp.MustCompile(nonEnglishPattern).MatchString(email) {
|
||||
return false, errors.New("email contains non-English characters, please use only English")
|
||||
}
|
||||
|
||||
emailPattern := `^[a-z0-9@._-]+$`
|
||||
if !regexp.MustCompile(emailPattern).MatchString(email) {
|
||||
return false, errors.New("email contains invalid characters, please use only lowercase letters, digits, and @._-")
|
||||
|
Loading…
Reference in New Issue
Block a user