aboutsummaryrefslogtreecommitdiff
path: root/wizard
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-02-06 19:19:54 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-02-06 19:19:54 +0300
commit1364c2b4988d0fad4ef236ca09bff226432764ce (patch)
tree542471c4aefdae74748cdf18e60dab2f440bbc01 /wizard
parent1571118e7b59779629afdbe5d69e0c69ec75f1aa (diff)
downloadmonzero-gui-1364c2b4988d0fad4ef236ca09bff226432764ce.tar.gz
monzero-gui-1364c2b4988d0fad4ef236ca09bff226432764ce.tar.xz
monzero-gui-1364c2b4988d0fad4ef236ca09bff226432764ce.zip
Password strength level updated
Diffstat (limited to 'wizard')
-rw-r--r--wizard/WizardMain.qml60
-rw-r--r--wizard/WizardPassword.qml17
-rw-r--r--wizard/WizardRecoveryWallet.qml4
3 files changed, 49 insertions, 32 deletions
diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml
index a52c219f..6b25be1d 100644
--- a/wizard/WizardMain.qml
+++ b/wizard/WizardMain.qml
@@ -34,9 +34,13 @@ Rectangle {
property alias nextButton : nextButton
property var settings : ({})
property int currentPage: 0
- property var pages: [welcomePage, optionsPage, createWalletPage, recoveryWalletPage,
- passwordPage,/*configurePage,*/ donationPage, finishPage ]
- property string path;
+
+ property var paths: {
+ "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ],
+ "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ]
+ }
+ property string currentPath: "create_wallet"
+ property var pages: paths[currentPath]
signal useMoneroClicked()
border.color: "#DBDBDB"
@@ -51,20 +55,8 @@ Rectangle {
print ("switchpage: start: currentPage: ", currentPage);
if (currentPage > 0 || currentPage < pages.length - 1) {
-
pages[currentPage].opacity = 0
-
var step_value = next ? 1 : -1
- // special case - we stepping backward from password page:
- // previous page "createWallet" or "recoveryWallet"
- if (!next) {
- print ("stepping back: current page: ", currentPage);
- if ((pages[currentPage] === passwordPage && path === "create_walled")
- || (pages[currentPage] === recoveryWalletPage) ) {
- step_value *= 2;
- }
- }
-
currentPage += step_value
pages[currentPage].opacity = 1;
handlePageChanged();
@@ -73,25 +65,38 @@ Rectangle {
}
function handlePageChanged() {
- // disable "next" button until passwords match
- if (pages[currentPage] === passwordPage) {
+ switch (pages[currentPage]) {
+ case passwordPage:
+ // disable "next" button until passwords match
nextButton.enabled = passwordPage.passwordValid;
- } else if (pages[currentPage] === finishPage) {
+ if (currentPath === "create_wallet") {
+ passwordPage.titleText = qsTr("Now that your wallet has been created, please set a password for the wallet")
+ } else {
+ passwordPage.titleText = qsTr("Now that your wallet has been restored, please set a password for the wallet")
+ }
+ break;
+ case finishPage:
// display settings summary
finishPage.updateSettingsSummary();
- nextButton.visible = false
- } else {
- var enableButton = pages[currentPage] !== optionsPage;
- nextButton.visible = nextButton.enabled = enableButton
- print ("nextButtonVisible: ", enableButton)
+ nextButton.visible = false;
+ break;
+ case recoveryWalletPage:
+ // TODO: disable "next button" until 25 words private key entered
+ // nextButton.enabled = false;
+ break
+ default:
+ var nextButtonVisible = pages[currentPage] !== optionsPage;
+ //nextButton.visible = nextButton.enabled = nextButtonVisible;
}
+
}
function openCreateWalletPage() {
print ("show create wallet page");
pages[currentPage].opacity = 0;
createWalletPage.opacity = 1
- path = "create_wallet";
+ currentPath = "create_wallet"
+ pages = paths[currentPath]
currentPage = pages.indexOf(createWalletPage)
handlePageChanged()
}
@@ -100,7 +105,8 @@ Rectangle {
print ("show recovery wallet page");
pages[currentPage].opacity = 0
recoveryWalletPage.opacity = 1
- path = "recovery_wallet"
+ currentPath = "recovery_wallet"
+ pages = paths[currentPath]
currentPage = pages.indexOf(recoveryWalletPage)
handlePageChanged()
}
@@ -134,8 +140,6 @@ Rectangle {
}
-
-
WizardWelcome {
id: welcomePage
anchors.top: parent.top
@@ -246,7 +250,7 @@ Rectangle {
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
- visible: parent.pages[currentPage] === finishPage
+ visible: parent.paths[currentPath][currentPage] === finishPage
onClicked: wizard.useMoneroClicked()
}
}
diff --git a/wizard/WizardPassword.qml b/wizard/WizardPassword.qml
index d12409ea..eb9d9c2c 100644
--- a/wizard/WizardPassword.qml
+++ b/wizard/WizardPassword.qml
@@ -28,10 +28,15 @@
import QtQuick 2.2
import "../components"
+import "utils.js" as Utils
Item {
opacity: 0
visible: false
+ property bool passwordValid : passwordItem.password != ''
+ && passwordItem.password === retypePasswordItem.password
+
+ property alias titleText: titleText.text
Behavior on opacity {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
@@ -40,12 +45,15 @@ Item {
function handlePassword() {
// allow to forward step only if passwords match
- // TODO: update password strength
wizard.nextButton.enabled = passwordItem.password === retypePasswordItem.password
+ // scorePassword returns value from 1..100
+ var strength = Utils.scorePassword(passwordItem.password)
+ // privacyLevel component uses 1..13 scale
+ privacyLevel.fillLevel = Utils.mapScope(1, 100, 1, 13, strength)
}
- property bool passwordValid : passwordItem.password != ''
- && passwordItem.password === retypePasswordItem.password
+
+
Row {
@@ -84,6 +92,7 @@ Item {
spacing: 24
Text {
+ id: titleText
anchors.left: parent.left
width: headerColumn.width - dotsRow.width - 16
font.family: "Arial"
@@ -91,7 +100,7 @@ Item {
wrapMode: Text.Wrap
//renderType: Text.NativeRendering
color: "#3F3F3F"
- text: qsTr("Now that your wallet has been created, please set a password for the wallet")
+
}
Text {
diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml
index 46af302b..9093c59a 100644
--- a/wizard/WizardRecoveryWallet.qml
+++ b/wizard/WizardRecoveryWallet.qml
@@ -55,5 +55,9 @@ Item {
wordsTextItem.tipTextVisible: false
wordsTextItem.memoTextReadOnly: false
wordsTextItem.memoText: ""
+ wordsTextItem.onMemoTextChanged: {
+ var wordsArray = wordsTextItem.memoText.trim().split(" ")
+ //wizard.nextButton.enabled = wordsArray.length === 25
+ }
}
}