MCPcopy Create free account
hub / github.com/supabase/auth / validateEmail

Method validateEmail

internal/api/mail.go:708–720  ·  view source on GitHub ↗
(email string)

Source from the content-addressed store, hash-verified

706}
707
708func (a *API) validateEmail(email string) (string, error) {
709 if email == "" {
710 return "", apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "An email address is required")
711 }
712 if len(email) > 255 {
713 return "", apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "An email address is too long")
714 }
715 if err := checkmail.ValidateFormat(email); err != nil {
716 return "", apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "Unable to validate email address: %s", err.Error())
717 }
718
719 return strings.ToLower(email), nil
720}
721
722func validateSentWithinFrequencyLimit(sentAt *time.Time, frequency time.Duration) error {
723 if sentAt != nil && sentAt.Add(frequency).After(time.Now()) {

Callers 12

shouldCreateUserMethod · 0.95
InviteMethod · 0.95
SignupMethod · 0.95
adminGenerateLinkMethod · 0.95
adminUserUpdateMethod · 0.95
adminUserCreateMethod · 0.95
ValidateMethod · 0.80
ValidateMethod · 0.80
ValidateMethod · 0.80
ValidateMethod · 0.80
TestValidateEmailMethod · 0.80

Calls 2

NewBadRequestErrorFunction · 0.92
ErrorMethod · 0.45

Tested by 1

TestValidateEmailMethod · 0.64