wizard: disable password strenght meter on mobiles

This commit is contained in:
Jaquee 2017-08-06 17:48:50 +02:00
parent bcb7bcffdb
commit 0e6028aacf
2 changed files with 21 additions and 13 deletions

View file

@ -83,6 +83,10 @@ ColumnLayout {
} }
function switchPage(next) { function switchPage(next) {
// Android focus workaround
releaseFocus();
// save settings for current page; // save settings for current page;
if (next && typeof pages[currentPage].onPageClosed !== 'undefined') { if (next && typeof pages[currentPage].onPageClosed !== 'undefined') {
if (pages[currentPage].onPageClosed(settings) !== true) { if (pages[currentPage].onPageClosed(settings) !== true) {

View file

@ -42,19 +42,22 @@ ColumnLayout {
wizard.nextButton.enabled = passwordItem.password === retypePasswordItem.password wizard.nextButton.enabled = passwordItem.password === retypePasswordItem.password
// scorePassword returns value from 0 to... lots // TODO: password strength meter segfaults on Android.
var strength = walletManager.getPasswordStrength(passwordItem.password); if (!isMobile) {
// consider anything below 10 bits as dire // scorePassword returns value from 0 to... lots
strength -= 10 var strength = walletManager.getPasswordStrength(passwordItem.password);
if (strength < 0) // consider anything below 10 bits as dire
strength = 0 strength -= 10
// use a slight parabola to discourage short passwords if (strength < 0)
strength = strength ^ 1.2 / 3 strength = 0
// mapScope does not clamp // use a slight parabola to discourage short passwords
if (strength > 100) strength = strength ^ 1.2 / 3
strength = 100 // mapScope does not clamp
// privacyLevel component uses 1..13 scale if (strength > 100)
privacyLevel.fillLevel = Utils.mapScope(1, 100, 1, 13, strength) strength = 100
// privacyLevel component uses 1..13 scale
privacyLevel.fillLevel = Utils.mapScope(1, 100, 1, 13, strength)
}
} }
function resetFocus() { function resetFocus() {
@ -85,6 +88,7 @@ ColumnLayout {
} }
PrivacyLevelSmall { PrivacyLevelSmall {
visible: !isMobile //TODO: strength meter doesnt work on Android
Layout.topMargin: isMobile ? 20 * scaleRatio : 40 * scaleRatio Layout.topMargin: isMobile ? 20 * scaleRatio : 40 * scaleRatio
Layout.fillWidth: true Layout.fillWidth: true
id: privacyLevel id: privacyLevel