-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wizard: move mnemonic seed into a separate screen #3677
Conversation
569579e
to
a737b14
Compare
@GBKS, could you please create a new version of the pdf template with the following text:
|
Hi there, here's an update to the template. I am not a fan of screaming at users with huge capitalized text and exclamation marks, so I put the instructions (and warning notice) at the top so it's clearly noticeable. Let me know what you think. |
82d7da2
to
c85c036
Compare
@GBKS Thank you, it's really nice. I've just finished coding this PR and had to modify some things, so I'd like to kindly ask you to do some changes: Required changes:
Suggested changes:
Below are some examples of the required positioning of mnemonic seed words in each template (so that it matches what is displayed on Monero GUI): |
10c08c0
to
26a4c00
Compare
d75b87d
to
5b37fee
Compare
@GBKS It would also be nice to have a dedicated icon for the "verify your recovery phrase" header, something like this: |
4c2a756
to
388f615
Compare
Did you get opening a PDF from qrc to work yet? I doesn't seem to work on Mac. As far as I know you have to write it to disk first before you can open it. |
diff --git a/wizard/SeedListItem.qml b/wizard/SeedListItem.qml
index 81b417cc..7fc19fe3 100644
--- a/wizard/SeedListItem.qml
+++ b/wizard/SeedListItem.qml
@@ -37,14 +37,8 @@ ColumnLayout {
} else {
return header.forceActiveFocus();
}
- } else if (wordNumber >= 5 && wordNumber < 10) {
- return parent.children[wizardCreateWallet2.firstHiddenWord].lineEdit.forceActiveFocus()
- } else if (wordNumber >= 10 && wordNumber < 15) {
- return parent.children[wizardCreateWallet2.secondHiddenWord].lineEdit.forceActiveFocus()
- } else if (wordNumber >= 15 && wordNumber < 20) {
- return parent.children[wizardCreateWallet2.thirdHiddenWord].lineEdit.forceActiveFocus()
- } else {
- return parent.children[wizardCreateWallet2.fourthHiddenWord].lineEdit.forceActiveFocus()
+ } else if (wordNumber >= 5 && wordNumber < 25) {
+ return parent.children[wizardCreateWallet2.hiddenWords[parseInt(wordNumber / 5) - 1]].lineEdit.forceActiveFocus()
}
} else {
if (wordNumber == 0) {
@@ -61,14 +55,8 @@ ColumnLayout {
function focusOnNextField() {
if (wizardCreateWallet2.state == "verify") {
- if (wordNumber < 5) {
- return parent.children[wizardCreateWallet2.secondHiddenWord].lineEdit.forceActiveFocus()
- } else if (wordNumber >= 5 && wordNumber < 10) {
- return parent.children[wizardCreateWallet2.thirdHiddenWord].lineEdit.forceActiveFocus()
- } else if (wordNumber >= 10 && wordNumber < 15) {
- return parent.children[wizardCreateWallet2.fourthHiddenWord].lineEdit.forceActiveFocus()
- } else if (wordNumber >= 15 && wordNumber < 20){
- return parent.children[wizardCreateWallet2.fifthHiddenWord].lineEdit.forceActiveFocus()
+ if (wordNumber < 20) {
+ return parent.children[wizardCreateWallet2.hiddenWords[parseInt(wordNumber / 5) + 1]].lineEdit.forceActiveFocus()
} else {
return navigation.btnPrev.forceActiveFocus()
}
diff --git a/wizard/WizardCreateWallet2.qml b/wizard/WizardCreateWallet2.qml
index 98ca4227..a4160702 100644
--- a/wizard/WizardCreateWallet2.qml
+++ b/wizard/WizardCreateWallet2.qml
@@ -45,11 +45,7 @@ Rectangle {
property string viewName: "wizardCreateWallet2"
property var seedArray: wizardController.walletOptionsSeed.split(" ")
property var seedListGrid: ""
- property var firstHiddenWord: ""
- property var secondHiddenWord: ""
- property var thirdHiddenWord: ""
- property var fourthHiddenWord: ""
- property var fifthHiddenWord: ""
+ property var hiddenWords: [0, 5, 10, 15, 20]
Clipboard { id: clipboard }
@@ -214,10 +210,10 @@ Rectangle {
function focusOnListGrid() {
if (wizardCreateWallet2.state == "verify") {
- if (seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].lineEdit.visible) {
- return seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].lineEdit.forceActiveFocus();
+ if (seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[0]].lineEdit.visible) {
+ return seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[0]].lineEdit.forceActiveFocus();
} else {
- return seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].forceActiveFocus();
+ return seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[0]].forceActiveFocus();
}
} else {
return seedListGridColumn.children[0].children[0].forceActiveFocus();
@@ -249,21 +245,11 @@ Rectangle {
id: seedListGridColumn
function clearFields() {
- seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].wordText.visible = true;
- seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].lineEdit.text = "";
- seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].lineEdit.readOnly = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.secondHiddenWord].wordText.visible = true;
- seedListGridColumn.children[0].children[wizardCreateWallet2.secondHiddenWord].lineEdit.text = "";
- seedListGridColumn.children[0].children[wizardCreateWallet2.secondHiddenWord].lineEdit.readOnly = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.thirdHiddenWord].wordText.visible = true;
- seedListGridColumn.children[0].children[wizardCreateWallet2.thirdHiddenWord].lineEdit.text = "";
- seedListGridColumn.children[0].children[wizardCreateWallet2.thirdHiddenWord].lineEdit.readOnly = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fourthHiddenWord].wordText.visible = true;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fourthHiddenWord].lineEdit.text = "";
- seedListGridColumn.children[0].children[wizardCreateWallet2.fourthHiddenWord].lineEdit.readOnly = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].wordText.visible = true;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].lineEdit.text = "";
- seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].lineEdit.readOnly = false;
+ for (var i = 0; i < wizardCreateWallet2.hiddenWords.length; i++) {
+ seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[i]].wordText.visible = true;
+ seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[i]].lineEdit.text = "";
+ seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[i]].lineEdit.readOnly = false;
+ }
}
}
@@ -295,7 +281,7 @@ Rectangle {
text: qsTr("Print a template") + translationManager.emptyString
tooltip: qsTr("Print a template to write down your seed") + translationManager.emptyString
onClicked: {
- oshelper.openFile("template.pdf")
+ Qt.openUrlExternally(":/template.pdf")
}
Accessible.role: Accessible.Button
Accessible.name: qsTr("Print a blank template to write down your seed") + translationManager.emptyString
@@ -391,30 +377,26 @@ Rectangle {
mobileDialog.visible = Qt.binding(function() { return wizardController.layoutScale == 4 })
}
btnPrevKeyNavigationBackTab: wizardCreateWallet2.state == "default" ? walletRestoreHeight
- : seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].lineEdit.visible ? seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].lineEdit
+ : seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[4]].lineEdit.visible ? seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[4]].lineEdit
: seedListGridColumn.children[0].children[24]
btnNextKeyNavigationTab: mobileDialog.visible ? mobileHeader : header
btnNext.enabled: walletCreationDate.opacity == 1 ? true
- : seedListGridColumn.children[0].children[firstHiddenWord].icon.wordsMatch &&
- seedListGridColumn.children[0].children[secondHiddenWord].icon.wordsMatch &&
- seedListGridColumn.children[0].children[thirdHiddenWord].icon.wordsMatch &&
- seedListGridColumn.children[0].children[fourthHiddenWord].icon.wordsMatch &&
- seedListGridColumn.children[0].children[fifthHiddenWord].icon.wordsMatch
+ : seedListGridColumn.children[0].children[hiddenWords[0]].icon.wordsMatch &&
+ seedListGridColumn.children[0].children[hiddenWords[1]].icon.wordsMatch &&
+ seedListGridColumn.children[0].children[hiddenWords[2]].icon.wordsMatch &&
+ seedListGridColumn.children[0].children[hiddenWords[3]].icon.wordsMatch &&
+ seedListGridColumn.children[0].children[hiddenWords[4]].icon.wordsMatch
onNextClicked: {
//choose five random words to hide
- wizardCreateWallet2.firstHiddenWord = Math.floor(Math.random() * 5)
- wizardCreateWallet2.secondHiddenWord = Math.floor(Math.random() * 5) + 5
- wizardCreateWallet2.thirdHiddenWord = Math.floor(Math.random() * 5) + 10
- wizardCreateWallet2.fourthHiddenWord = Math.floor(Math.random() * 5) + 15
- wizardCreateWallet2.fifthHiddenWord = Math.floor(Math.random() * 5) + 20
+ for (var i = 0; i < hiddenWords.length; i++) {
+ wizardCreateWallet2.hiddenWords[i] = Math.floor(Math.random() * 5) + 5 * i
+ }
wizardCreateWallet2.state = "verify";
- seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].wordText.visible = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.secondHiddenWord].wordText.visible = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.thirdHiddenWord].wordText.visible = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fourthHiddenWord].wordText.visible = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.fifthHiddenWord].wordText.visible = false;
- seedListGridColumn.children[0].children[wizardCreateWallet2.firstHiddenWord].lineEdit.forceActiveFocus();
+ for (var i = 0; i < hiddenWords.length; i++) {
+ seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[i]].wordText.visible = false;
+ }
+ seedListGridColumn.children[0].children[wizardCreateWallet2.hiddenWords[0]].lineEdit.forceActiveFocus();
}
}
} Using an array makes this code simpler. |
It's working on Windows and Ubuntu. I haven't tested on Mac yet. |
So the only thing remaining here is getting the PDF to work on Mac? |
c1eb151
to
add3a44
Compare
Yes |
font.bold: true | ||
textFormat: Text.RichText | ||
color: MoneroComponents.Style.defaultFontColor | ||
text: currentDate.toLocaleDateString(locale, Locale.ShortFormat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about specifying it as YYYY-MM-DD
? That's the format that is required for the restore height textbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the default LocaleDateString. Later I want to display a calendar during wallet restore instead of asking for YYYY-MM-DD, which is not familiar to users from multiple countries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALOT of beginners forget the "-" or just type the date incorrectly. This would save alot of people pain if a calendar was implemented 👍
Added "create a new seed" button |
964e574
to
920aa62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple minor comments. Did you test the binaries that were created with CI to check if the PDF works in them?
… template; seed verification; responsive UI; accessibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a merge conflict, a rebase is required.
diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp
index a910dae8..ddf3d9ed 100644
--- a/src/main/oshelper.cpp
+++ b/src/main/oshelper.cpp
@@ -292,3 +292,9 @@ bool OSHelper::installed() const
return false;
#endif
}
+
+void OSHelper::openSeedTemplate() const
+{
+ QFile::copy(":/wizard/template.pdf", QDir::tempPath() + "/seed_template.pdf");
+ openFile(QDir::tempPath() + "/seed_template.pdf");
+}
diff --git a/src/main/oshelper.h b/src/main/oshelper.h
index 2d8d41f0..d171fc57 100644
--- a/src/main/oshelper.h
+++ b/src/main/oshelper.h
@@ -53,6 +53,7 @@ public:
Q_INVOKABLE QString temporaryPath() const;
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
Q_INVOKABLE bool isCapsLock() const;
+ Q_INVOKABLE void openSeedTemplate() const;
private:
bool installed() const;
diff --git a/wizard/WizardCreateWallet2.qml b/wizard/WizardCreateWallet2.qml
index 475e722f..04c2bf99 100644
--- a/wizard/WizardCreateWallet2.qml
+++ b/wizard/WizardCreateWallet2.qml
@@ -316,11 +316,10 @@ Rectangle {
id: printPDFTemplate
small: true
primary: false
- visible: !isMac
text: qsTr("Print a template") + translationManager.emptyString
tooltip: qsTr("Print a template to write down your seed") + translationManager.emptyString
onClicked: {
- oshelper.openFile("wizard/template.pdf")
+ oshelper.openSeedTemplate();
}
Accessible.role: Accessible.Button
Accessible.name: qsTr("Print a template to write down your seed") + translationManager.emptyString
This solves saving the PDF on macOS. I did not test it on other OS.
It saves the PDF to the temp directory and then it gets opened. The PDF inside the temp directory gets deleted after the next computer reboot. |
@rating89us did you time to update this so that we can merge it? :) |
Let's continue here: #3878 |
Closes #2043
This PR introduces a dedicated page to the mnemonic seed + a pdf template to be printed (with 25 blank fields). When the user clicks on Next button, 5 random words are hidden and the user is requested to type them to confirm that the mnemonic seed was written down.
Main changes:
Writing down seed and verifying it:
Choosing 5 new random words to hide (on in each column) every time verification page is opened
Resizing from 5 columns (desktop) to 2 columns (mobile)