diff --git a/api.go b/api.go index cc82f2f37a..771242fb2d 100644 --- a/api.go +++ b/api.go @@ -53,7 +53,6 @@ func getAuth(srv *Server, w http.ResponseWriter, r *http.Request) ([]byte, error func postAuth(srv *Server, w http.ResponseWriter, r *http.Request) ([]byte, error) { var config auth.AuthConfig if err := json.NewDecoder(r.Body).Decode(&config); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) return nil, err } @@ -73,8 +72,8 @@ func postAuth(srv *Server, w http.ResponseWriter, r *http.Request) ([]byte, erro b, err := json.Marshal(ApiAuth{status}) if err != nil { return nil, err - return b, nil } + return b, nil } w.WriteHeader(http.StatusOK) return nil, nil diff --git a/commands.go b/commands.go index 167834397a..a6aa1c46cc 100644 --- a/commands.go +++ b/commands.go @@ -270,11 +270,12 @@ func CmdLogin(args ...string) error { } var out2 ApiAuth - err = json.Unmarshal(body, &out) + err = json.Unmarshal(body, &out2) if err != nil { return err } if out2.Status != "" { + RestoreTerminal(oldState) fmt.Print(out2.Status) } return nil