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/confirm.ui \
|
||||
src/privkey.ui \
|
||||
src/memodialog.ui \
|
||||
src/memodialog.ui \
|
||||
src/verifyseed.ui \
|
||||
src/startupencryption.ui \
|
||||
src/viewalladdresses.ui \
|
||||
src/connection.ui \
|
||||
|
||||
@@ -2,12 +2,29 @@
|
||||
|
||||
#include "ui_newseed.h"
|
||||
#include "ui_restoreseed.h"
|
||||
#include "ui_verifyseed.h"
|
||||
#include "ui_newwallet.h"
|
||||
#include "mainwindow.h"
|
||||
#include "DataStore/DataStore.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)
|
||||
{
|
||||
@@ -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) {
|
||||
setTitle("Create or Restore wallet.");
|
||||
|
||||
@@ -200,6 +241,8 @@ void NewSeedPage::initializePage() {
|
||||
QString birthday = QString::number(parsed["birthday"].get<json::number_unsigned_t>());
|
||||
QString seed = QString::fromStdString(parsed["seed"].get<json::string_t>());
|
||||
form.txtSeed->setPlainText(seed);
|
||||
parent->setSeed(seed);
|
||||
parent->setBirthday(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
|
||||
// before we allow the page to be closed
|
||||
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", "");
|
||||
QString reply = litelib_process_response(resp);
|
||||
|
||||
@@ -222,6 +278,20 @@ bool NewSeedPage::validatePage() {
|
||||
} else {
|
||||
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:
|
||||
FirstTimeWizard(bool dangerous, QString server);
|
||||
QString getSeed();
|
||||
void setSeed(QString Seed);
|
||||
QString _seed;
|
||||
QString getBirthday();
|
||||
void setBirthday(QString Birthday);
|
||||
QString _birthday;
|
||||
|
||||
|
||||
protected:
|
||||
@@ -51,6 +57,7 @@ public:
|
||||
class NewSeedPage: public QWizardPage {
|
||||
public:
|
||||
NewSeedPage(FirstTimeWizard* parent);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void initializePage();
|
||||
|
||||
@@ -1,51 +1,85 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>verifyseed</class>
|
||||
<widget class="QDialog" name="verifyseed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>458</width>
|
||||
<height>333</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<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>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Please enter your Seed :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>verifyseed</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -54,14 +88,14 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>verifyseed</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -69,4 +103,3 @@
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user