verify that the user Backup the seed and birthday at creation
This commit is contained in:
@@ -138,7 +138,8 @@ FORMS += \
|
|||||||
src/about.ui \
|
src/about.ui \
|
||||||
src/confirm.ui \
|
src/confirm.ui \
|
||||||
src/privkey.ui \
|
src/privkey.ui \
|
||||||
src/memodialog.ui \
|
src/memodialog.ui \
|
||||||
|
src/verifyseed.ui \
|
||||||
src/startupencryption.ui \
|
src/startupencryption.ui \
|
||||||
src/viewalladdresses.ui \
|
src/viewalladdresses.ui \
|
||||||
src/connection.ui \
|
src/connection.ui \
|
||||||
|
|||||||
@@ -2,12 +2,29 @@
|
|||||||
|
|
||||||
#include "ui_newseed.h"
|
#include "ui_newseed.h"
|
||||||
#include "ui_restoreseed.h"
|
#include "ui_restoreseed.h"
|
||||||
|
#include "ui_verifyseed.h"
|
||||||
#include "ui_newwallet.h"
|
#include "ui_newwallet.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "DataStore/DataStore.h"
|
#include "DataStore/DataStore.h"
|
||||||
|
|
||||||
#include "../lib/silentdragonlitelib.h"
|
#include "../lib/silentdragonlitelib.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat");
|
||||||
|
auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat");
|
||||||
|
auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup");
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat");
|
||||||
|
auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat");
|
||||||
|
auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup");
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.dat");
|
||||||
|
auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat");
|
||||||
|
auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.datBackup");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
|
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
|
||||||
{
|
{
|
||||||
@@ -48,6 +65,30 @@ int FirstTimeWizard::nextId() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FirstTimeWizard::getSeed()
|
||||||
|
{
|
||||||
|
|
||||||
|
return _seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FirstTimeWizard::setSeed(QString seed)
|
||||||
|
{
|
||||||
|
|
||||||
|
_seed = seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FirstTimeWizard::getBirthday()
|
||||||
|
{
|
||||||
|
|
||||||
|
return _birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FirstTimeWizard::setBirthday(QString birthday)
|
||||||
|
{
|
||||||
|
|
||||||
|
_birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
||||||
setTitle("Create or Restore wallet.");
|
setTitle("Create or Restore wallet.");
|
||||||
|
|
||||||
@@ -200,6 +241,8 @@ void NewSeedPage::initializePage() {
|
|||||||
QString birthday = QString::number(parsed["birthday"].get<json::number_unsigned_t>());
|
QString birthday = QString::number(parsed["birthday"].get<json::number_unsigned_t>());
|
||||||
QString seed = QString::fromStdString(parsed["seed"].get<json::string_t>());
|
QString seed = QString::fromStdString(parsed["seed"].get<json::string_t>());
|
||||||
form.txtSeed->setPlainText(seed);
|
form.txtSeed->setPlainText(seed);
|
||||||
|
parent->setSeed(seed);
|
||||||
|
parent->setBirthday(birthday);
|
||||||
form.birthday->setPlainText(birthday);
|
form.birthday->setPlainText(birthday);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +252,19 @@ void NewSeedPage::initializePage() {
|
|||||||
// Will be called just before closing. Make sure we can save the seed in the wallet
|
// Will be called just before closing. Make sure we can save the seed in the wallet
|
||||||
// before we allow the page to be closed
|
// before we allow the page to be closed
|
||||||
bool NewSeedPage::validatePage() {
|
bool NewSeedPage::validatePage() {
|
||||||
|
|
||||||
|
Ui_verifyseed verifyseed;
|
||||||
|
QDialog dialog(this);
|
||||||
|
verifyseed.setupUi(&dialog);
|
||||||
|
Settings::saveRestore(&dialog);
|
||||||
|
|
||||||
|
dialog.exec();
|
||||||
|
|
||||||
|
QString seed = parent->getSeed();
|
||||||
|
QString birthday = parent->getBirthday();
|
||||||
|
|
||||||
|
if ((verifyseed.verifyText->toPlainText() == seed) && (verifyseed.verifyBirthday->toPlainText() == birthday ))
|
||||||
|
{
|
||||||
char* resp = litelib_execute("save", "");
|
char* resp = litelib_execute("save", "");
|
||||||
QString reply = litelib_process_response(resp);
|
QString reply = litelib_process_response(resp);
|
||||||
|
|
||||||
@@ -222,6 +278,20 @@ bool NewSeedPage::validatePage() {
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
qDebug()<<"Falscher Seed";
|
||||||
|
QFile file(dirwalletencfirst);
|
||||||
|
QFile file1(dirwalletfirst);
|
||||||
|
|
||||||
|
file.remove();
|
||||||
|
file1.remove();
|
||||||
|
QMessageBox::warning(this, tr("Wrong Seed"),
|
||||||
|
tr("Please try again") + "\n" ,
|
||||||
|
QMessageBox::Ok);
|
||||||
|
return false;
|
||||||
|
this->validatePage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ class FirstTimeWizard: public QWizard
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FirstTimeWizard(bool dangerous, QString server);
|
FirstTimeWizard(bool dangerous, QString server);
|
||||||
|
QString getSeed();
|
||||||
|
void setSeed(QString Seed);
|
||||||
|
QString _seed;
|
||||||
|
QString getBirthday();
|
||||||
|
void setBirthday(QString Birthday);
|
||||||
|
QString _birthday;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -51,6 +57,7 @@ public:
|
|||||||
class NewSeedPage: public QWizardPage {
|
class NewSeedPage: public QWizardPage {
|
||||||
public:
|
public:
|
||||||
NewSeedPage(FirstTimeWizard* parent);
|
NewSeedPage(FirstTimeWizard* parent);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializePage();
|
virtual void initializePage();
|
||||||
|
|||||||
@@ -1,51 +1,85 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<author></author>
|
<ui version="4.0">
|
||||||
<comment></comment>
|
<class>verifyseed</class>
|
||||||
<exportmacro></exportmacro>
|
<widget class="QDialog" name="verifyseed">
|
||||||
<class>Dialog</class>
|
<property name="geometry">
|
||||||
<widget class="QDialog" name="Dialog" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>458</width>
|
||||||
<height>300</height>
|
<height>333</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="geometry" >
|
<item row="0" column="0">
|
||||||
<rect>
|
<widget class="QLabel" name="label">
|
||||||
<x>30</x>
|
<property name="text">
|
||||||
<y>240</y>
|
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Please verify, that you have backup your Seed and Birthday. </span></p></body></html></string>
|
||||||
<width>341</width>
|
</property>
|
||||||
<height>32</height>
|
</widget>
|
||||||
</rect>
|
</item>
|
||||||
</property>
|
<item row="1" column="0">
|
||||||
<property name="orientation" >
|
<widget class="QLabel" name="label_2">
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="text">
|
||||||
</property>
|
<string>Please enter your Seed :</string>
|
||||||
<property name="standardButtons" >
|
</property>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="2" column="0">
|
||||||
|
<widget class="QTextEdit" name="verifyText">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>121</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Please enter the birthday of the Seed :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QTextEdit" name="verifyBirthday">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>41</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction></pixmapfunction>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>Dialog</receiver>
|
<receiver>verifyseed</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>248</x>
|
<x>248</x>
|
||||||
<y>254</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
@@ -54,14 +88,14 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>Dialog</receiver>
|
<receiver>verifyseed</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>316</x>
|
||||||
<y>260</y>
|
<y>260</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
@@ -69,4 +103,3 @@
|
|||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user