Update min text length in password

This commit is contained in:
alexjba 2022-11-21 09:30:11 +02:00 committed by Alex Jbanca
parent fee883b650
commit 98d3073a61
5 changed files with 73 additions and 31 deletions

View File

@ -22,7 +22,6 @@ import "../panels"
StatusModal { StatusModal {
id: root id: root
property int minPswLen: 10
readonly property int marginBetweenInputs: 38 readonly property int marginBetweenInputs: 38
property var emojiPopup: null property var emojiPopup: null

View File

@ -4,10 +4,10 @@
<context> <context>
<name>AppMain</name> <name>AppMain</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/mainui/AppMain.qml" line="572"/> <location filename="../app/mainui/AppMain.qml" line="611"/>
<location filename="../app/mainui/AppMain.qml" line="581"/> <location filename="../app/mainui/AppMain.qml" line="620"/>
<location filename="../app/mainui/AppMain.qml" line="572"/> <location filename="../app/mainui/AppMain.qml" line="611"/>
<location filename="../app/mainui/AppMain.qml" line="581"/> <location filename="../app/mainui/AppMain.qml" line="620"/>
<source>%n issue(s)</source> <source>%n issue(s)</source>
<translation> <translation>
<numerusform>%n issue</numerusform> <numerusform>%n issue</numerusform>
@ -18,8 +18,8 @@
<context> <context>
<name>ChatHeaderContentView</name> <name>ChatHeaderContentView</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/AppLayouts/Chat/views/ChatHeaderContentView.qml" line="291"/> <location filename="../app/AppLayouts/Chat/views/ChatHeaderContentView.qml" line="282"/>
<location filename="../app/AppLayouts/Chat/views/ChatHeaderContentView.qml" line="291"/> <location filename="../app/AppLayouts/Chat/views/ChatHeaderContentView.qml" line="282"/>
<source>%n member(s)</source> <source>%n member(s)</source>
<translation> <translation>
<numerusform>%n member</numerusform> <numerusform>%n member</numerusform>
@ -54,8 +54,8 @@
<context> <context>
<name>CommunityColumnView</name> <name>CommunityColumnView</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/AppLayouts/Chat/views/CommunityColumnView.qml" line="58"/> <location filename="../app/AppLayouts/Chat/views/CommunityColumnView.qml" line="59"/>
<location filename="../app/AppLayouts/Chat/views/CommunityColumnView.qml" line="58"/> <location filename="../app/AppLayouts/Chat/views/CommunityColumnView.qml" line="59"/>
<source>%n member(s)</source> <source>%n member(s)</source>
<translation> <translation>
<numerusform>%n member</numerusform> <numerusform>%n member</numerusform>
@ -102,8 +102,17 @@
<context> <context>
<name>DiscordImportProgressContents</name> <name>DiscordImportProgressContents</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="284"/> <location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="241"/>
<location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="284"/> <location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="241"/>
<source>%n more issue(s) downloading assets</source>
<translation>
<numerusform>%n more issue downloading assets</numerusform>
<numerusform>%n more issues downloading assets</numerusform>
</translation>
</message>
<message numerus="yes">
<location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="287"/>
<location filename="../app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml" line="287"/>
<source>%1 was imported with %n issue(s).</source> <source>%1 was imported with %n issue(s).</source>
<translation> <translation>
<numerusform>%1 was imported with %n issue.</numerusform> <numerusform>%1 was imported with %n issue.</numerusform>
@ -126,8 +135,8 @@
<context> <context>
<name>ImportSeedPhrasePanel</name> <name>ImportSeedPhrasePanel</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml" line="263"/> <location filename="../app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml" line="258"/>
<location filename="../app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml" line="263"/> <location filename="../app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml" line="258"/>
<source>%n word(s)</source> <source>%n word(s)</source>
<translation> <translation>
<numerusform>%n word</numerusform> <numerusform>%n word</numerusform>
@ -171,10 +180,10 @@
<context> <context>
<name>KeycardPin</name> <name>KeycardPin</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="266"/> <location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="287"/>
<location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="301"/> <location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="322"/>
<location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="266"/> <location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="287"/>
<location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="301"/> <location filename="../imports/shared/popups/keycard/states/KeycardPin.qml" line="322"/>
<source>%n attempt(s) remaining</source> <source>%n attempt(s) remaining</source>
<translation> <translation>
<numerusform>%n attempt remaining</numerusform> <numerusform>%n attempt remaining</numerusform>
@ -197,8 +206,8 @@
<context> <context>
<name>KeycardPuk</name> <name>KeycardPuk</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../imports/shared/popups/keycard/states/KeycardPuk.qml" line="145"/> <location filename="../imports/shared/popups/keycard/states/KeycardPuk.qml" line="160"/>
<location filename="../imports/shared/popups/keycard/states/KeycardPuk.qml" line="145"/> <location filename="../imports/shared/popups/keycard/states/KeycardPuk.qml" line="160"/>
<source>%n attempt(s) remaining</source> <source>%n attempt(s) remaining</source>
<translation> <translation>
<numerusform>%n attempt remaining</numerusform> <numerusform>%n attempt remaining</numerusform>
@ -221,8 +230,8 @@
<context> <context>
<name>LoginView</name> <name>LoginView</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../app/AppLayouts/Onboarding/views/LoginView.qml" line="1074"/> <location filename="../app/AppLayouts/Onboarding/views/LoginView.qml" line="1077"/>
<location filename="../app/AppLayouts/Onboarding/views/LoginView.qml" line="1074"/> <location filename="../app/AppLayouts/Onboarding/views/LoginView.qml" line="1077"/>
<source>%n attempt(s) remaining</source> <source>%n attempt(s) remaining</source>
<translation> <translation>
<numerusform>%n attempt remaining</numerusform> <numerusform>%n attempt remaining</numerusform>
@ -254,6 +263,27 @@
</translation> </translation>
</message> </message>
</context> </context>
<context>
<name>PasswordView</name>
<message numerus="yes">
<location filename="../imports/shared/views/PasswordView.qml" line="23"/>
<location filename="../imports/shared/views/PasswordView.qml" line="23"/>
<source>Minimum %n character(s). To strengthen your password consider including:</source>
<translation>
<numerusform>Minimum %n character. To strengthen your password consider including:</numerusform>
<numerusform>Minimum %n characters. To strengthen your password consider including:</numerusform>
</translation>
</message>
<message numerus="yes">
<location filename="../imports/shared/views/PasswordView.qml" line="119"/>
<location filename="../imports/shared/views/PasswordView.qml" line="119"/>
<source>Password must be at least %n character(s) long</source>
<translation>
<numerusform>Password must be at least %n character long</numerusform>
<numerusform>Password must be at least %n characters long</numerusform>
</translation>
</message>
</context>
<context> <context>
<name>PinnedMessagesPopup</name> <name>PinnedMessagesPopup</name>
<message numerus="yes"> <message numerus="yes">
@ -302,4 +332,16 @@
</translation> </translation>
</message> </message>
</context> </context>
<context>
<name>Utils</name>
<message numerus="yes">
<location filename="../imports/utils/Utils.qml" line="375"/>
<location filename="../imports/utils/Utils.qml" line="375"/>
<source>Password needs to be %n character(s) or more</source>
<translation>
<numerusform>Password needs to be %n character or more</numerusform>
<numerusform>Password needs to be %n characters or more</numerusform>
</translation>
</message>
</context>
</TS> </TS>

View File

@ -14,14 +14,13 @@ import StatusQ.Components 0.1
ColumnLayout { ColumnLayout {
id: root id: root
property bool ready: newPswInput.text.length >= root.minPswLen && newPswInput.text === confirmPswInput.text && errorTxt.text === "" property bool ready: newPswInput.text.length >= Constants.minPasswordLength && newPswInput.text === confirmPswInput.text && errorTxt.text === ""
property int minPswLen: 10
property bool createNewPsw: true property bool createNewPsw: true
property string title: qsTr("Create a password") property string title: qsTr("Create a password")
property bool titleVisible: true property bool titleVisible: true
property string introText: qsTr("Create a password to unlock Status on this device & sign transactions.") property string introText: qsTr("Create a password to unlock Status on this device & sign transactions.")
property string recoverText: qsTr("You will not be able to recover this password if it is lost.") property string recoverText: qsTr("You will not be able to recover this password if it is lost.")
property string strengthenText: qsTr("Minimum %1 characters. To strengthen your password consider including:").arg(minPswLen) property string strengthenText: qsTr("Minimum %n character(s). To strengthen your password consider including:", "", Constants.minPasswordLength)
property bool highSizeIntro: false property bool highSizeIntro: false
property var passwordStrengthScoreFunction: function () {} property var passwordStrengthScoreFunction: function () {}
@ -62,7 +61,7 @@ ColumnLayout {
return return
} }
if(newPswInput.text.length >= root.minPswLen) { if(newPswInput.text.length >= Constants.minPasswordLength) {
errorTxt.text = "" errorTxt.text = ""
if(confirmPswInput.text !== newPswInput.text) { if(confirmPswInput.text !== newPswInput.text) {
errorTxt.text = qsTr("Passwords don't match") errorTxt.text = qsTr("Passwords don't match")
@ -117,7 +116,7 @@ ColumnLayout {
// * Password too short // * Password too short
else if(isTooShort()) else if(isTooShort())
errorTxt.text = qsTr("Password must be at least %1 characters long").arg(root.minPswLen) errorTxt.text = qsTr("Password must be at least %n character(s) long", "", Constants.minPasswordLength)
} }
function isInPwndDatabase() { function isInPwndDatabase() {
@ -130,7 +129,7 @@ ColumnLayout {
return false return false
} }
function isTooShort() { return newPswInput.text.length < root.minPswLen } function isTooShort() { return newPswInput.text.length < Constants.minPasswordLength }
} }
spacing: Style.current.bigPadding spacing: Style.current.bigPadding
@ -237,9 +236,9 @@ ColumnLayout {
StatusPasswordStrengthIndicator { StatusPasswordStrengthIndicator {
id: strengthInditactor id: strengthInditactor
Layout.fillWidth: true Layout.fillWidth: true
value: Math.min(root.minPswLen, newPswInput.text.length) value: Math.min(Constants.minPasswordLength, newPswInput.text.length)
from: 0 from: 0
to: root.minPswLen to: Constants.minPasswordLength
labelVeryWeak: qsTr("Very weak") labelVeryWeak: qsTr("Very weak")
labelWeak: qsTr("Weak") labelWeak: qsTr("Weak")
labelSoso: qsTr("So-so") labelSoso: qsTr("So-so")

View File

@ -690,6 +690,8 @@ QtObject {
readonly property string existingAccountError: "account already exists" readonly property string existingAccountError: "account already exists"
readonly property string wrongDerivationPathError: "error parsing derivation path" readonly property string wrongDerivationPathError: "error parsing derivation path"
readonly property int minPasswordLength: 10
enum TransactionStatus { enum TransactionStatus {
Failure = 0, Failure = 0,
Success = 1 Success = 1

View File

@ -371,8 +371,8 @@ QtObject {
case "first": case "first":
if (firstPasswordField.text === "") { if (firstPasswordField.text === "") {
return [false, qsTr("You need to enter a password")]; return [false, qsTr("You need to enter a password")];
} else if (firstPasswordField.text.length < 6) { } else if (firstPasswordField.text.length < Constants.minPasswordLength) {
return [false, qsTr("Password needs to be 6 characters or more")]; return [false, qsTr("Password needs to be %n character(s) or more", "", Constants.minPasswordLength)];
} }
return [true, ""]; return [true, ""];