diff --git a/src/controllers/authentication.go b/src/controllers/authentication.go index d6e133e..4da5d24 100644 --- a/src/controllers/authentication.go +++ b/src/controllers/authentication.go @@ -43,6 +43,8 @@ func Authenticate(w http.ResponseWriter, r *http.Request) { if !models.ValidateCredentials(&loginForm) { log.Printf("Invalid credentials.") + w.Header().Set("Content-Type", "text/json") + w.Write([]byte("{\"state\":\"wrong credentials\"}")) return } @@ -75,4 +77,7 @@ func Authenticate(w http.ResponseWriter, r *http.Request) { } log.Printf(`| {"user": %s, "time": %d}`, loginForm.Username, time.Now().Unix()) + + w.Header().Set("Content-Type", "text/json") + w.Write([]byte("{\"state\":\"success\"}")) }