Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: logic of email validation (#877)

Zeng19982b2792de73ec
diff --git a/api/user.go b/api/user.go
index 1c3b4f906..ef7c1e4b7 100644
--- a/api/user.go
+++ b/api/user.go
@@ -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")
}
}