Browse Source

only one passphrase at beginning

pull/130/head
DenioD 4 years ago
parent
commit
e2caf2b3e8
  1. 3
      src/DataStore/ChatDataStore.cpp
  2. 29
      src/mainwindow.cpp
  3. 45
      src/startupencryption.ui

3
src/DataStore/ChatDataStore.cpp

@ -60,8 +60,7 @@ std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") &&
(c.second.isContact() == false) &&
(c.second.getMemo().isEmpty())
(c.second.isContact() == false)
)
{

29
src/mainwindow.cpp

@ -538,34 +538,15 @@ void MainWindow::removeWalletEncryptionStartUp() {
QDialog d(this);
Ui_startup ed;
ed.setupUi(&d);
// Handle edits on the password box
auto fnPasswordEdited = [=](const QString&) {
QString password = ed.txtPassword->text();
// Enable the OK button if the passwords match.
if (!ed.txtPassword->text().isEmpty() &&
ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
ed.lblPasswordMatch->setText("");
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
} else {
ed.lblPasswordMatch->setText(tr("Passwords don't match or under-lettered"));
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}
};
QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
if (d.exec() == QDialog::Accepted)
{
QString str = ed.txtPassword->text(); // data comes from user inputs
int length = str.length();
this->setPassword(str);
QString password = ed.txtPassword->text(); // data comes from user inputs
int length = password.length();
this->setPassword(password);
char *sequence = NULL;
sequence = new char[length+1];
strncpy(sequence, str.toLocal8Bit(), length +1);
strncpy(sequence, password.toLocal8Bit(), length +1);
#define MESSAGE ((const unsigned char *) sequence)
#define MESSAGE_LEN length
@ -614,7 +595,7 @@ void MainWindow::removeWalletEncryptionStartUp() {
{
QMessageBox::warning(this, tr("You have still Plaintextdata on your disk!"),
QMessageBox::information(this, tr("You have still Plaintextdata on your disk!"),
QString("WARNING: Delete it only if you have a backup of your Wallet Seed."),
QMessageBox::Ok
);

45
src/startupencryption.ui

@ -29,19 +29,6 @@
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>229</y>
<width>127</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Confirm Password:</string>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
@ -55,19 +42,6 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLineEdit" name="txtConfirmPassword">
<property name="geometry">
<rect>
<x>162</x>
<y>229</y>
<width>230</width>
<height>25</height>
</rect>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
@ -113,25 +87,6 @@
<string>Encryption Password:</string>
</property>
</widget>
<widget class="QLabel" name="lblPasswordMatch">
<property name="geometry">
<rect>
<x>10</x>
<y>175</y>
<width>382</width>
<height>17</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: red;</string>
</property>
<property name="text">
<string>Passwords don't match</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="txtPassword">
<property name="geometry">
<rect>

Loading…
Cancel
Save