mirror of
https://github.com/usememos/memos.git
synced 2025-03-24 06:30:09 +01:00
fix: logic of email validation (#877)
* fix: fix logic of email validation * update
This commit is contained in:
parent
c9bb2b785d
commit
2b2792de73
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user