summaryrefslogtreecommitdiffstats
path: root/models/user/email_address.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user/email_address.go')
-rw-r--r--models/user/email_address.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/models/user/email_address.go b/models/user/email_address.go
index c931db9c16..d87b945706 100644
--- a/models/user/email_address.go
+++ b/models/user/email_address.go
@@ -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
}
@@ -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}
}