Replace in.readLine() with Utils::getPassword()

Fixes #1673.
This commit is contained in:
Alessio Di Mauro 2018-03-08 16:24:11 +01:00 committed by Janek Bevendorff
parent 082ecc3f37
commit f164847f9b

View File

@ -29,6 +29,8 @@
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/MessageBox.h" #include "gui/MessageBox.h"
#include "cli/Utils.h"
#if defined(WITH_ASAN) && defined(WITH_LSAN) #if defined(WITH_ASAN) && defined(WITH_LSAN)
#include <sanitizer/lsan_interface.h> #include <sanitizer/lsan_interface.h>
#endif #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 // 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 // buffer for native messaging, even if the specified file does not exist
static QTextStream in(stdin, QIODevice::ReadOnly); 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)) { if (!filename.isEmpty() && QFile::exists(filename) && !filename.endsWith(".json", Qt::CaseInsensitive)) {