aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frederic Guillot <fred@miniflux.net>2018-12-09 17:44:33 -0800
committerGravatar Frederic Guillot <fred@miniflux.net>2018-12-09 17:44:33 -0800
commit61bfb3cfa8857a144460d05330c1d1fccded960b (patch)
tree485ab80e6122a830ca4c27df6d09826102c1a7ce
parent87648490fda1d765fb7b78544b2b01847550c82b (diff)
Make password prompt compatible with Windows
-rw-r--r--cli/ask_credentials.go14
-rw-r--r--go.mod2
-rw-r--r--go.sum2
-rw-r--r--[-rwxr-xr-x]locale/locale.go0
-rw-r--r--[-rwxr-xr-x]locale/translations.go0
-rw-r--r--[-rwxr-xr-x]locale/translations/pl_PL.json0
-rwxr-xr-xreader/parser/debug.testbin9543972 -> 0 bytes
7 files changed, 15 insertions, 3 deletions
diff --git a/cli/ask_credentials.go b/cli/ask_credentials.go
index bd4bf5f..9021d9b 100644
--- a/cli/ask_credentials.go
+++ b/cli/ask_credentials.go
@@ -14,13 +14,23 @@ import (
)
func askCredentials() (string, string) {
- reader := bufio.NewReader(os.Stdin)
+ fd := int(os.Stdin.Fd())
+
+ if !terminal.IsTerminal(fd) {
+ fmt.Fprintf(os.Stderr, "This is not a terminal, exiting.")
+ os.Exit(1)
+ }
fmt.Print("Enter Username: ")
+
+ reader := bufio.NewReader(os.Stdin)
username, _ := reader.ReadString('\n')
fmt.Print("Enter Password: ")
- bytePassword, _ := terminal.ReadPassword(0)
+
+ state, _ := terminal.GetState(fd)
+ defer terminal.Restore(fd, state)
+ bytePassword, _ := terminal.ReadPassword(fd)
fmt.Printf("\n")
return strings.TrimSpace(username), strings.TrimSpace(string(bytePassword))
diff --git a/go.mod b/go.mod
index 577e270..789f294 100644
--- a/go.mod
+++ b/go.mod
@@ -11,7 +11,7 @@ require (
github.com/lib/pq v1.0.0
github.com/tdewolff/minify v2.3.5+incompatible // indirect
github.com/tdewolff/parse v2.3.3+incompatible // indirect
- golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac
+ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
diff --git a/go.sum b/go.sum
index 213c0f3..e5ef72a 100644
--- a/go.sum
+++ b/go.sum
@@ -20,6 +20,8 @@ golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8 h1:h7zdf0RiEvWbYBKIx4b+q4
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac h1:7d7lG9fHOLdL6jZPtnV4LpI41SbohIJ1Atq7U991dMg=
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180706051357-32a936f46389 h1:U+zCn5sqaq+q4hrnMrz9sgrW1yatwEOUgYkGt3u9ZOU=
golang.org/x/net v0.0.0-20180706051357-32a936f46389/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
diff --git a/locale/locale.go b/locale/locale.go
index a59d4c4..a59d4c4 100755..100644
--- a/locale/locale.go
+++ b/locale/locale.go
diff --git a/locale/translations.go b/locale/translations.go
index d5cde4d..d5cde4d 100755..100644
--- a/locale/translations.go
+++ b/locale/translations.go
diff --git a/locale/translations/pl_PL.json b/locale/translations/pl_PL.json
index 3a3e0f6..3a3e0f6 100755..100644
--- a/locale/translations/pl_PL.json
+++ b/locale/translations/pl_PL.json
diff --git a/reader/parser/debug.test b/reader/parser/debug.test
deleted file mode 100755
index f97b9b3..0000000
--- a/reader/parser/debug.test
+++ /dev/null
Binary files differ