Skip to content

Commit

Permalink
fix: logic of email validation (usememos#877)
Browse files Browse the repository at this point in the history
* fix: fix logic of email validation

* update
  • Loading branch information
Zeng1998 authored Dec 30, 2022
1 parent c9bb2b7 commit 2b2792d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
}
Expand Down

0 comments on commit 2b2792d

Please sign in to comment.