From 7e4fdbf3474d69bdf5738e4c5daab615412bdd0c Mon Sep 17 00:00:00 2001 From: Chandra Mouli B Date: Thu, 28 Aug 2025 00:15:16 +0530 Subject: [PATCH] Use mail parse address to validate Signed-off-by: Chandra Mouli B --- pkg/usrmgr/usrmgr.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/usrmgr/usrmgr.go b/pkg/usrmgr/usrmgr.go index 07bce1443..0be1173ef 100644 --- a/pkg/usrmgr/usrmgr.go +++ b/pkg/usrmgr/usrmgr.go @@ -18,6 +18,7 @@ import ( "context" "errors" "fmt" + "net/mail" "net/url" "strings" "time" @@ -251,7 +252,7 @@ func (s Service) SignUp( return nil, nil, &ErrSignupDisabled{} } - if !strings.Contains(email, "@") { + if _, err := mail.ParseAddress(email); err != nil { return nil, nil, &ErrInvalidEmail{email} }