fix login
This commit is contained in:
parent
1d42cbaa21
commit
24c785bc06
2 changed files with 3 additions and 3 deletions
3
api.go
3
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue