fix login

This commit is contained in:
Victor Vieux 2013-05-08 23:57:14 +02:00
parent 1d42cbaa21
commit 24c785bc06
2 changed files with 3 additions and 3 deletions

3
api.go
View file

@ -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

View file

@ -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