Skip to content

Commit

Permalink
fix(login): fix crash with using resp before error check (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal authored and jbrockopp committed Jan 24, 2020
1 parent bb7ee8b commit e9f69af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ func authenticate(c *cli.Context) error {
}

auth, resp, err := client.Authorization.Login(&req)
if err != nil {
return err
}

// If user hits an endpoint other than the
// Vela server that can't process request
// bomb out and throw error
if http.StatusUnauthorized < resp.StatusCode {
return fmt.Errorf("unable to process request")
}
if resp.StatusCode != http.StatusUnauthorized && err != nil {
return err
}

// retry authentication in case user requires an OTP code
switch resp.StatusCode {
Expand Down

0 comments on commit e9f69af

Please sign in to comment.