Disable stdin echo when entering passwords on cli

This commit is contained in:
Weslly 2017-06-21 00:05:24 -03:00
parent 7438d6db18
commit 400073c7cc
6 changed files with 111 additions and 6 deletions

View file

@ -24,6 +24,7 @@
#include <QTimer>
#include <QXmlStreamReader>
#include "cli/PasswordInput.h"
#include "core/Group.h"
#include "core/Metadata.h"
#include "crypto/Random.h"
@ -398,13 +399,12 @@ Database* Database::openDatabaseFile(QString fileName, CompositeKey key)
Database* Database::unlockFromStdin(QString databaseFilename)
{
static QTextStream inputTextStream(stdin, QIODevice::ReadOnly);
QTextStream outputTextStream(stdout);
outputTextStream << QString("Insert password to unlock " + databaseFilename + "\n> ");
outputTextStream.flush();
QString line = inputTextStream.readLine();
QString line = PasswordInput::getPassword();
CompositeKey key = CompositeKey::readFromLine(line);
return Database::openDatabaseFile(databaseFilename, key);
}