Skip to content

Commit

Permalink
fix: validateEmail should normalise emails
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmingtay committed Oct 5, 2024
1 parent 410b8ac commit 007a0a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/api/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"net/http"
"strings"
"time"

"github.com/didip/tollbooth/v5"
Expand Down Expand Up @@ -559,7 +560,7 @@ func (a *API) validateEmail(email string) (string, error) {
return "", badRequestError(ErrorCodeValidationFailed, "Unable to validate email address: "+err.Error())
}

return email, nil
return strings.ToLower(email), nil
}

func validateSentWithinFrequencyLimit(sentAt *time.Time, frequency time.Duration) error {
Expand Down

0 comments on commit 007a0a2

Please sign in to comment.