mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-28 18:56:32 +02:00
Password strength level updated
This commit is contained in:
parent
1571118e7b
commit
1364c2b498
@ -36,6 +36,13 @@ Item {
|
|||||||
height: 40
|
height: 40
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
onFillLevelChanged: {
|
||||||
|
if (!interactive) {
|
||||||
|
//print("fillLevel: " + fillLevel)
|
||||||
|
fillRect.width = row.positions[fillLevel].currentX + row.x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@ -134,6 +141,7 @@ Item {
|
|||||||
if(index !== -1) {
|
if(index !== -1) {
|
||||||
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
|
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
|
||||||
item.fillLevel = index
|
item.fillLevel = index
|
||||||
|
print ("fillLevel: " + item.fillLevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +156,7 @@ Item {
|
|||||||
anchors.rightMargin: 8
|
anchors.rightMargin: 8
|
||||||
anchors.top: bar.bottom
|
anchors.top: bar.bottom
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
property var positions: new Array()
|
property var positions: []
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row2
|
id: row2
|
||||||
|
@ -55,7 +55,7 @@ QML_IMPORT_PATH =
|
|||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
include(deployment.pri)
|
include(deployment.pri)
|
||||||
|
|
||||||
DISTFILES += \
|
|
||||||
|
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
@ -67,3 +67,4 @@ OTHER_FILES += \
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,9 +34,13 @@ Rectangle {
|
|||||||
property alias nextButton : nextButton
|
property alias nextButton : nextButton
|
||||||
property var settings : ({})
|
property var settings : ({})
|
||||||
property int currentPage: 0
|
property int currentPage: 0
|
||||||
property var pages: [welcomePage, optionsPage, createWalletPage, recoveryWalletPage,
|
|
||||||
passwordPage,/*configurePage,*/ donationPage, finishPage ]
|
property var paths: {
|
||||||
property string path;
|
"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()
|
signal useMoneroClicked()
|
||||||
border.color: "#DBDBDB"
|
border.color: "#DBDBDB"
|
||||||
@ -51,20 +55,8 @@ Rectangle {
|
|||||||
print ("switchpage: start: currentPage: ", currentPage);
|
print ("switchpage: start: currentPage: ", currentPage);
|
||||||
|
|
||||||
if (currentPage > 0 || currentPage < pages.length - 1) {
|
if (currentPage > 0 || currentPage < pages.length - 1) {
|
||||||
|
|
||||||
pages[currentPage].opacity = 0
|
pages[currentPage].opacity = 0
|
||||||
|
|
||||||
var step_value = next ? 1 : -1
|
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
|
currentPage += step_value
|
||||||
pages[currentPage].opacity = 1;
|
pages[currentPage].opacity = 1;
|
||||||
handlePageChanged();
|
handlePageChanged();
|
||||||
@ -73,25 +65,38 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handlePageChanged() {
|
function handlePageChanged() {
|
||||||
// disable "next" button until passwords match
|
switch (pages[currentPage]) {
|
||||||
if (pages[currentPage] === passwordPage) {
|
case passwordPage:
|
||||||
|
// disable "next" button until passwords match
|
||||||
nextButton.enabled = passwordPage.passwordValid;
|
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
|
// display settings summary
|
||||||
finishPage.updateSettingsSummary();
|
finishPage.updateSettingsSummary();
|
||||||
nextButton.visible = false
|
nextButton.visible = false;
|
||||||
} else {
|
break;
|
||||||
var enableButton = pages[currentPage] !== optionsPage;
|
case recoveryWalletPage:
|
||||||
nextButton.visible = nextButton.enabled = enableButton
|
// TODO: disable "next button" until 25 words private key entered
|
||||||
print ("nextButtonVisible: ", enableButton)
|
// nextButton.enabled = false;
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
var nextButtonVisible = pages[currentPage] !== optionsPage;
|
||||||
|
//nextButton.visible = nextButton.enabled = nextButtonVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openCreateWalletPage() {
|
function openCreateWalletPage() {
|
||||||
print ("show create wallet page");
|
print ("show create wallet page");
|
||||||
pages[currentPage].opacity = 0;
|
pages[currentPage].opacity = 0;
|
||||||
createWalletPage.opacity = 1
|
createWalletPage.opacity = 1
|
||||||
path = "create_wallet";
|
currentPath = "create_wallet"
|
||||||
|
pages = paths[currentPath]
|
||||||
currentPage = pages.indexOf(createWalletPage)
|
currentPage = pages.indexOf(createWalletPage)
|
||||||
handlePageChanged()
|
handlePageChanged()
|
||||||
}
|
}
|
||||||
@ -100,7 +105,8 @@ Rectangle {
|
|||||||
print ("show recovery wallet page");
|
print ("show recovery wallet page");
|
||||||
pages[currentPage].opacity = 0
|
pages[currentPage].opacity = 0
|
||||||
recoveryWalletPage.opacity = 1
|
recoveryWalletPage.opacity = 1
|
||||||
path = "recovery_wallet"
|
currentPath = "recovery_wallet"
|
||||||
|
pages = paths[currentPath]
|
||||||
currentPage = pages.indexOf(recoveryWalletPage)
|
currentPage = pages.indexOf(recoveryWalletPage)
|
||||||
handlePageChanged()
|
handlePageChanged()
|
||||||
}
|
}
|
||||||
@ -134,8 +140,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WizardWelcome {
|
WizardWelcome {
|
||||||
id: welcomePage
|
id: welcomePage
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -246,7 +250,7 @@ Rectangle {
|
|||||||
shadowPressedColor: "#B32D00"
|
shadowPressedColor: "#B32D00"
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
visible: parent.pages[currentPage] === finishPage
|
visible: parent.paths[currentPath][currentPage] === finishPage
|
||||||
onClicked: wizard.useMoneroClicked()
|
onClicked: wizard.useMoneroClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,15 @@
|
|||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import "../components"
|
import "../components"
|
||||||
|
import "utils.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
visible: false
|
visible: false
|
||||||
|
property bool passwordValid : passwordItem.password != ''
|
||||||
|
&& passwordItem.password === retypePasswordItem.password
|
||||||
|
|
||||||
|
property alias titleText: titleText.text
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
|
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
|
||||||
}
|
}
|
||||||
@ -40,12 +45,15 @@ Item {
|
|||||||
|
|
||||||
function handlePassword() {
|
function handlePassword() {
|
||||||
// allow to forward step only if passwords match
|
// allow to forward step only if passwords match
|
||||||
// TODO: update password strength
|
|
||||||
wizard.nextButton.enabled = passwordItem.password === retypePasswordItem.password
|
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 {
|
Row {
|
||||||
@ -84,6 +92,7 @@ Item {
|
|||||||
spacing: 24
|
spacing: 24
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: titleText
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
width: headerColumn.width - dotsRow.width - 16
|
width: headerColumn.width - dotsRow.width - 16
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
@ -91,7 +100,7 @@ Item {
|
|||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
//renderType: Text.NativeRendering
|
//renderType: Text.NativeRendering
|
||||||
color: "#3F3F3F"
|
color: "#3F3F3F"
|
||||||
text: qsTr("Now that your wallet has been created, please set a password for the wallet")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
@ -55,5 +55,9 @@ Item {
|
|||||||
wordsTextItem.tipTextVisible: false
|
wordsTextItem.tipTextVisible: false
|
||||||
wordsTextItem.memoTextReadOnly: false
|
wordsTextItem.memoTextReadOnly: false
|
||||||
wordsTextItem.memoText: ""
|
wordsTextItem.memoText: ""
|
||||||
|
wordsTextItem.onMemoTextChanged: {
|
||||||
|
var wordsArray = wordsTextItem.memoText.trim().split(" ")
|
||||||
|
//wizard.nextButton.enabled = wordsArray.length === 25
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user