Skip to content

Commit

Permalink
Validate type in bounce webhook API.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Aug 22, 2021
1 parent 158ea9f commit 27e1e83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/bounce.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ func validateBounceFields(b models.Bounce, app *App) error {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidData"))
}

if b.Type != models.BounceTypeHard && b.Type != models.BounceTypeSoft {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidData"))
}

if b.Email != "" && !subimporter.IsEmail(b.Email) {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidEmail"))
}
Expand Down

0 comments on commit 27e1e83

Please sign in to comment.