From 74f438afad4d51793ee1eed272167f70d871585a Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Mon, 21 Aug 2023 21:19:35 -0400 Subject: [PATCH] miscellaneous characters from my keyboard --- src/website/auth.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/website/auth.go b/src/website/auth.go index 274cdf2..117c82c 100644 --- a/src/website/auth.go +++ b/src/website/auth.go @@ -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 +}