aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-15 13:25:50 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-15 13:25:50 +0200
commit40980b33b77a87d846cb1ff632d39766d2d0949f (patch)
tree571ba5c15815fde8d4d5453e6758c022a0505328
parentMerge pull request #4549 (diff)
parentpassword: fix secure input with echo on windows (diff)
downloadmonero-40980b33b77a87d846cb1ff632d39766d2d0949f.tar.xz
Merge pull request #4550
0e33cf89 password: fix secure input with echo on windows (moneromooo-monero)
-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 e41c75088..b3c51128f 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;