fix: logic of email validation (#877)
* fix: fix logic of email validation * update
This commit is contained in:
parent
c9bb2b785d
commit
2b2792de73
1 changed files with 2 additions and 2 deletions
|
|
@ -76,7 +76,7 @@ func (create UserCreate) Validate() error {
|
||||||
if len(create.Email) > 256 {
|
if len(create.Email) > 256 {
|
||||||
return fmt.Errorf("email is too long, maximum length is 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")
|
return fmt.Errorf("invalid email format")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ func (patch UserPatch) Validate() error {
|
||||||
if len(*patch.Email) > 256 {
|
if len(*patch.Email) > 256 {
|
||||||
return fmt.Errorf("email is too long, maximum length is 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")
|
return fmt.Errorf("invalid email format")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue