Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ func (r *RootCmd) login() *clibase.Cmd {
}

sessionToken, err = cliui.Prompt(inv, cliui.PromptOptions{
Text: "Paste your token here:",
Secret: true,
Text: "Paste your token here:",
Validate: func(token string) error {
client.SetSessionToken(token)
_, err := client.User(ctx, codersdk.Me)
Expand Down
9 changes: 9 additions & 0 deletions cli/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli_test
import (
"context"
"fmt"
"runtime"
"testing"

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

pty.ExpectMatch("Paste your token here:")
pty.WriteLine(client.SessionToken())
if runtime.GOOS != "windows" {
// For some reason, the match does not show up on Windows.
pty.ExpectMatch(client.SessionToken())
}
Comment on lines +174 to +177
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually validated that this works on Windows, just appears to be a weird feature of ptytest. Disabling the session token echo check on Windows for now.

pty.ExpectMatch("Welcome to Coder")
<-doneChan
})
Expand All @@ -193,6 +198,10 @@ func TestLogin(t *testing.T) {

pty.ExpectMatch("Paste your token here:")
pty.WriteLine("an-invalid-token")
if runtime.GOOS != "windows" {
// For some reason, the match does not show up on Windows.
pty.ExpectMatch("an-invalid-token")
}
pty.ExpectMatch("That's not a valid token!")
cancelFunc()
<-doneChan
Expand Down