diff options
author | Emile <hanemile@protonmail.com> | 2019-10-09 12:27:21 +0200 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-10-09 12:27:21 +0200 |
commit | 043664ff80186b00f818c3542b42c797987b804f (patch) | |
tree | 47fd225e614f79109df160083528ababa8c14b32 | |
parent | c2359a77045bc0610e82204fe1d244f513b23c5c (diff) |
filtering out bad usernames such as traefik and register
-rw-r--r-- | src/http.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http.go b/src/http.go index 9632787..7bddad6 100644 --- a/src/http.go +++ b/src/http.go @@ -67,6 +67,10 @@ func registerPostHandler(w http.ResponseWriter, r *http.Request) { return } + if !isValid(username) { + indexHander(w, r) + } + // add the new username to the list of usernames usernames = append(usernames, username) @@ -107,6 +111,13 @@ func isUniq(username string) bool { return true } +func isValid(username string) bool { + if username == "traefik" || username == "register" { + return false + } + return true +} + func readFileToReponse(w http.ResponseWriter, path string) { requestedFile := strings.Replace(path, "..", "", -1) |