aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-10 12:15:20 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-10 12:37:47 +0000
commit0e33cf89d2e351b2306e66a7d23ede880208fbee (patch)
tree9bcd11e87aea5ba9634c8d2e7fc70bf8194d15ab /src
parentMerge pull request #4540 (diff)
downloadmonero-0e33cf89d2e351b2306e66a7d23ede880208fbee.tar.xz
password: fix secure input with echo on windows
Thanks to iDunk for the testing back and forth
Diffstat (limited to 'src')
-rw-r--r--src/common/password.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/password.cpp b/src/common/password.cpp
index a8d5141dc..7ba3fcb42 100644
--- a/src/common/password.cpp
+++ b/src/common/password.cpp
@@ -60,7 +60,7 @@ namespace
DWORD mode_old;
::GetConsoleMode(h_cin, &mode_old);
- DWORD mode_new = mode_old & ~((hide_input ? ENABLE_ECHO_INPUT : 0) | ENABLE_LINE_INPUT);
+ DWORD mode_new = mode_old & ~(hide_input ? ENABLE_ECHO_INPUT : 0);
::SetConsoleMode(h_cin, mode_new);
bool r = true;
@@ -78,7 +78,11 @@ namespace
{
break;
}
- else if (ucs2_ch == L'\n' || ucs2_ch == L'\r')
+ else if (ucs2_ch == L'\r')
+ {
+ continue;
+ }
+ else if (ucs2_ch == L'\n')
{
std::cout << std::endl;
break;