diff --git a/registration/registar.go b/registration/registar.go index 77c390ee..4b612e50 100644 --- a/registration/registar.go +++ b/registration/registar.go @@ -156,15 +156,10 @@ func (r *Registrar) ResolveAccountByKey() (*Resource, error) { log.Infof("acme: Trying to resolve account by key") accMsg := acme.Account{OnlyReturnExisting: true} - accountTransit, err := r.core.Accounts.New(accMsg) + account, err := r.core.Accounts.New(accMsg) if err != nil { return nil, err } - account, err := r.core.Accounts.Get(accountTransit.Location) - if err != nil { - return nil, err - } - - return &Resource{URI: accountTransit.Location, Body: account}, nil + return &Resource{URI: account.Location, Body: account.Account}, nil } diff --git a/registration/registar_test.go b/registration/registar_test.go index 0e9b70b4..531ccebc 100644 --- a/registration/registar_test.go +++ b/registration/registar_test.go @@ -18,14 +18,7 @@ func TestRegistrar_ResolveAccountByKey(t *testing.T) { defer tearDown() mux.HandleFunc("/account", func(w http.ResponseWriter, _ *http.Request) { - w.Header().Set("Location", apiURL+"/account_recovery") - _, err := w.Write([]byte("{}")) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - }) - - mux.HandleFunc("/account_recovery", func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Location", apiURL+"/account") err := tester.WriteJSONResponse(w, acme.Account{ Status: "valid", })