Skip to content
5 changes: 2 additions & 3 deletions models/user/email_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (err ErrEmailCharIsNotSupported) Error() string {
}

// ErrEmailInvalid represents an error where the email address does not comply with RFC 5322
// or has a leading '-' character
type ErrEmailInvalid struct {
Email string
}
Expand Down Expand Up @@ -134,9 +135,7 @@ func ValidateEmail(email string) error {
return ErrEmailCharIsNotSupported{email}
}

if !(email[0] >= 'a' && email[0] <= 'z') &&
!(email[0] >= 'A' && email[0] <= 'Z') &&
!(email[0] >= '0' && email[0] <= '9') {
if email[0] == '-' {
return ErrEmailInvalid{email}
}

Expand Down