miscellaneous characters from my keyboard

This commit is contained in:
Ben Visness 2023-08-21 21:19:35 -04:00
parent ad62793262
commit 74f438afad
1 changed files with 11 additions and 3 deletions

View File

@ -202,9 +202,7 @@ func RegisterNewUserSubmit(c *RequestContext) ResponseData {
}
c.Perf.StartBlock("SQL", "Check blacklist")
// TODO(asaf): Check email against blacklist
blacklisted := false
if blacklisted {
if emailIsBlacklisted(emailAddress) {
// NOTE(asaf): Silent rejection so we don't allow attackers to harvest emails.
return c.Redirect(hmnurl.BuildRegistrationSuccess(), http.StatusSeeOther)
}
@ -882,3 +880,13 @@ func validateUsernameAndToken(c *RequestContext, username string, token string,
func urlIsLocal(url string) bool {
return strings.HasPrefix(url, config.Config.BaseUrl)
}
func emailIsBlacklisted(email string) bool {
if strings.Count(email, ".") > 5 {
return true
}
// TODO(asaf): Actually check email against blacklist
return false
}