From f164847f9bd20603475c5866227607e154fe3358 Mon Sep 17 00:00:00 2001
From: Alessio Di Mauro <alessio@alessiodimauro.com>
Date: Thu, 8 Mar 2018 16:24:11 +0100
Subject: [PATCH] Replace in.readLine() with Utils::getPassword()

Fixes #1673.
---
 src/main.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main.cpp b/src/main.cpp
index a7fd2d762..33aa5edd2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -29,6 +29,8 @@
 #include "gui/MainWindow.h"
 #include "gui/MessageBox.h"
 
+#include "cli/Utils.h"
+
 #if defined(WITH_ASAN) && defined(WITH_LSAN)
 #include <sanitizer/lsan_interface.h>
 #endif
@@ -148,7 +150,9 @@ int main(int argc, char** argv)
             // we always need consume a line of STDIN if --pw-stdin is set to clear out the
             // buffer for native messaging, even if the specified file does not exist
             static QTextStream in(stdin, QIODevice::ReadOnly);
-            password = in.readLine();
+            static QTextStream out(stdout, QIODevice::WriteOnly);
+            out << QCoreApplication::translate("Main", "Database password: ") << flush;
+            password = Utils::getPassword();
         }
 
         if (!filename.isEmpty() && QFile::exists(filename) && !filename.endsWith(".json", Qt::CaseInsensitive)) {