From c833b64d134d902883d67c179bf0e8a1f92de8bb Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Fri, 21 Feb 2020 01:05:19 +0100 Subject: [PATCH] login-validator: remove unused index page --- pkg/login-validator/cmd/index.go | 78 -------------------------------- pkg/login-validator/cmd/main.go | 5 +- 2 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 pkg/login-validator/cmd/index.go diff --git a/pkg/login-validator/cmd/index.go b/pkg/login-validator/cmd/index.go deleted file mode 100644 index e8e963f..0000000 --- a/pkg/login-validator/cmd/index.go +++ /dev/null @@ -1,78 +0,0 @@ -package main - -import ( - "net/http" - "text/template" -) - -const indextpl = ` - - - - Challenge Forensic - Administration - - - - - - - - -
-
- - {{"{{ box.title }}"}} {{"{{ box.msg }}"}} -
    -
  • {{"{{ i }}"}}
  • -
- - -
-
- -
- - - - - - - - - -` - -func Index(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "text/html") - - if indexTmpl, err := template.New("index").Parse(indextpl); err != nil { - http.Error(w, "Cannot create template: "+err.Error(), http.StatusInternalServerError) - } else if err := indexTmpl.Execute(w, nil); err != nil { - http.Error(w, "An error occurs during template execution: "+err.Error(), http.StatusInternalServerError) - } -} diff --git a/pkg/login-validator/cmd/main.go b/pkg/login-validator/cmd/main.go index d704e37..24447f2 100644 --- a/pkg/login-validator/cmd/main.go +++ b/pkg/login-validator/cmd/main.go @@ -75,7 +75,6 @@ func main() { log.Println("Registering handlers...") mux := http.NewServeMux() - mux.HandleFunc("/", Index) mux.Handle("/login", lc) mux.HandleFunc("/logout", logout) http.HandleFunc("/", mux.ServeHTTP) @@ -94,9 +93,7 @@ func main() { if lc.students, err = readStudentsList(studentsFile); err != nil { log.Println("Error during students.csv reload:", err) } - case syscall.SIGTERM: - break mloop; - case syscall.SIGINT: + case syscall.SIGTERM, syscall.SIGINT: break mloop; } }