fix: logic of email validation (#877)

* fix: fix logic of email validation

* update
This commit is contained in:
Zeng1998 2022-12-30 13:10:52 +08:00 committed by GitHub
parent c9bb2b785d
commit 2b2792de73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,7 @@ func (create UserCreate) Validate() error {
if len(create.Email) > 256 {
return fmt.Errorf("email is too long, maximum length is 256")
}
if common.ValidateEmail(create.Email) {
if !common.ValidateEmail(create.Email) {
return fmt.Errorf("invalid email format")
}
}
@ -118,7 +118,7 @@ func (patch UserPatch) Validate() error {
if len(*patch.Email) > 256 {
return fmt.Errorf("email is too long, maximum length is 256")
}
if common.ValidateEmail(*patch.Email) {
if !common.ValidateEmail(*patch.Email) {
return fmt.Errorf("invalid email format")
}
}