Use mail parse address to validate
Signed-off-by: Chandra Mouli B <bcmouli2006@gmail.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
2340fe3b9e
commit
7e4fdbf347
@@ -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}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user