mirror of
https://github.com/monero-project/monero-gui
synced 2024-12-20 04:15:53 +01:00
Password strength level updated
This commit is contained in:
parent
1571118e7b
commit
1364c2b498
@ -36,6 +36,13 @@ Item {
|
||||
height: 40
|
||||
clip: true
|
||||
|
||||
onFillLevelChanged: {
|
||||
if (!interactive) {
|
||||
//print("fillLevel: " + fillLevel)
|
||||
fillRect.width = row.positions[fillLevel].currentX + row.x
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@ -134,6 +141,7 @@ Item {
|
||||
if(index !== -1) {
|
||||
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
|
||||
item.fillLevel = index
|
||||
print ("fillLevel: " + item.fillLevel)
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +156,7 @@ Item {
|
||||
anchors.rightMargin: 8
|
||||
anchors.top: bar.bottom
|
||||
anchors.topMargin: 5
|
||||
property var positions: new Array()
|
||||
property var positions: []
|
||||
|
||||
Row {
|
||||
id: row2
|
||||
|
@ -55,7 +55,7 @@ QML_IMPORT_PATH =
|
||||
# Default rules for deployment.
|
||||
include(deployment.pri)
|
||||
|
||||
DISTFILES += \
|
||||
|
||||
|
||||
|
||||
OTHER_FILES += \
|
||||
@ -67,3 +67,4 @@ OTHER_FILES += \
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user