Implement secret key check
Anirudh Oppiliappan x@icyphox.sh
Sun, 06 Jun 2021 22:55:24 +0530
1 files changed,
7 insertions(+),
0 deletions(-)
jump to
M
main.go
→
main.go
@@ -30,6 +30,13 @@ return string(b)
} func (s *settings) uploadFile(w http.ResponseWriter, r *http.Request) { + key := r.FormValue("key") + fmt.Println(key) + if key != s.key { + fmt.Fprintf(w, "incorrect key") + log.Printf("incorrect key: %+v", key) + return + } r.ParseMultipartForm(10 << 20) file, handler, err := r.FormFile("file") if err != nil {