aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-15 13:47:53 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-15 13:47:54 +0200
commita9504f70014f360c2161f8631b2855ae98a3a616 (patch)
tree3b2263964b9c18d0512cf23d4c397a5144779bd6 /src/common
parentMerge pull request #4588 (diff)
parentpassword: fix secure input with echo on windows (diff)
downloadmonero-a9504f70014f360c2161f8631b2855ae98a3a616.tar.xz
Merge pull request #4587
067e232b password: fix secure input with echo on windows (moneromooo-monero)
Diffstat (limited to 'src/common')
-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;