Skip to content

Commit fae8a47

Browse files
authored
fix(cli): display pasted session token (coder#9710)
1 parent f89b680 commit fae8a47

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cli/login.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ func (r *RootCmd) login() *clibase.Cmd {
278278
}
279279

280280
sessionToken, err = cliui.Prompt(inv, cliui.PromptOptions{
281-
Text: "Paste your token here:",
282-
Secret: true,
281+
Text: "Paste your token here:",
283282
Validate: func(token string) error {
284283
client.SetSessionToken(token)
285284
_, err := client.User(ctx, codersdk.Me)

cli/login_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cli_test
33
import (
44
"context"
55
"fmt"
6+
"runtime"
67
"testing"
78

89
"github.com/stretchr/testify/assert"
@@ -170,6 +171,10 @@ func TestLogin(t *testing.T) {
170171

171172
pty.ExpectMatch("Paste your token here:")
172173
pty.WriteLine(client.SessionToken())
174+
if runtime.GOOS != "windows" {
175+
// For some reason, the match does not show up on Windows.
176+
pty.ExpectMatch(client.SessionToken())
177+
}
173178
pty.ExpectMatch("Welcome to Coder")
174179
<-doneChan
175180
})
@@ -193,6 +198,10 @@ func TestLogin(t *testing.T) {
193198

194199
pty.ExpectMatch("Paste your token here:")
195200
pty.WriteLine("an-invalid-token")
201+
if runtime.GOOS != "windows" {
202+
// For some reason, the match does not show up on Windows.
203+
pty.ExpectMatch("an-invalid-token")
204+
}
196205
pty.ExpectMatch("That's not a valid token!")
197206
cancelFunc()
198207
<-doneChan

0 commit comments

Comments
 (0)