summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkmcknight <kmcknight@gitlab.com>2022-01-21 17:33:40 -0800
committerkmcknight <kmcknight@gitlab.com>2022-01-21 17:33:40 -0800
commitf18d91511ab0107ac1060391f96f7a513ca7fb54 (patch)
tree77a530192d9a8812a966e189e7d94151e6a042b5
parentb38bbf3f57848588c03c20e97fda846831113282 (diff)
downloadgitlab-shell-f18d91511ab0107ac1060391f96f7a513ca7fb54.tar.gz
Passing pushauth flag as bool in json body to internal api doesn't become a bool in ruby; converting to string fixes it506-twofactorverify-command-to-support-push-notification
-rw-r--r--internal/gitlabnet/twofactorverify/client.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/gitlabnet/twofactorverify/client.go b/internal/gitlabnet/twofactorverify/client.go
index cf22cf8..b62396c 100644
--- a/internal/gitlabnet/twofactorverify/client.go
+++ b/internal/gitlabnet/twofactorverify/client.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
+ "strconv"
"gitlab.com/gitlab-org/gitlab-shell/client"
"gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs"
@@ -26,7 +27,7 @@ type RequestBody struct {
KeyId string `json:"key_id,omitempty"`
UserId int64 `json:"user_id,omitempty"`
OTPAttempt string `json:"otp_attempt"`
- PushAuth bool `json:"push_auth"`
+ PushAuth string `json:"push_auth"`
}
func NewClient(config *config.Config) (*Client, error) {
@@ -91,7 +92,7 @@ func (c *Client) getRequestBody(ctx context.Context, args *commandargs.Shell, ot
var requestBody *RequestBody
if args.GitlabKeyId != "" {
- requestBody = &RequestBody{KeyId: args.GitlabKeyId, OTPAttempt: otp, PushAuth: pushauth}
+ requestBody = &RequestBody{KeyId: args.GitlabKeyId, OTPAttempt: otp, PushAuth: strconv.FormatBool(pushauth)}
} else {
userInfo, err := client.GetByCommandArgs(ctx, args)
@@ -99,7 +100,7 @@ func (c *Client) getRequestBody(ctx context.Context, args *commandargs.Shell, ot
return nil, err
}
- requestBody = &RequestBody{UserId: userInfo.UserId, OTPAttempt: otp, PushAuth: pushauth}
+ requestBody = &RequestBody{UserId: userInfo.UserId, OTPAttempt: otp, PushAuth: strconv.FormatBool(pushauth)}
}
return requestBody, nil