chore: update user create validator

This commit is contained in:
Steven
2022-08-20 21:03:15 +08:00
parent 734d5f3aed
commit 05a5c59a7e
6 changed files with 88 additions and 18 deletions

View File

@ -1,6 +1,7 @@
package common
import (
"net/mail"
"strings"
"github.com/google/uuid"
@ -16,6 +17,14 @@ func HasPrefixes(src string, prefixes ...string) bool {
return false
}
// ValidateEmail validates the email.
func ValidateEmail(email string) bool {
if _, err := mail.ParseAddress(email); err != nil {
return false
}
return true
}
func GenUUID() string {
return uuid.New().String()
}