From 4b54751b4f7df14becddade929831226a872a0c4 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 12 Apr 2022 14:18:17 +0200 Subject: [PATCH] fix(@wallet): hide password from add watch only --- .../AppLayouts/Wallet/popups/AddAccountModal.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ui/app/AppLayouts/Wallet/popups/AddAccountModal.qml b/ui/app/AppLayouts/Wallet/popups/AddAccountModal.qml index a952ae80c8..edd53906ad 100644 --- a/ui/app/AppLayouts/Wallet/popups/AddAccountModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/AddAccountModal.qml @@ -69,6 +69,10 @@ StatusModal { } function validate() { + if (advancedSelection.expandableItem.addAccountType === SelectGeneratedAccount.AddAccountType.WatchOnly) { + return accountNameInput.valid + } + if (passwordInput.text === "") { //% "You need to enter a password" passwordValidationError = qsTrId("you-need-to-enter-a-password") @@ -78,6 +82,7 @@ StatusModal { } else { passwordValidationError = "" } + return passwordValidationError === "" && accountNameInput.valid } @@ -119,6 +124,7 @@ StatusModal { Item { width: parent.width height: passwordInput.height + visible: advancedSelection.expandableItem.addAccountType !== SelectGeneratedAccount.AddAccountType.WatchOnly Input { id: passwordInput anchors.fill: parent @@ -210,7 +216,15 @@ StatusModal { //% "Add account" qsTrId("add-account") - enabled: !loading && passwordInput.text !== "" && accountNameInput.text !== "" && advancedSelection.isValid + enabled: { + if (loading) { + return false + } + + return (advancedSelection.expandableItem.addAccountType === SelectGeneratedAccount.AddAccountType.WatchOnly || passwordInput.text !== "") && + accountNameInput.text !== "" && + advancedSelection.isValid + } MessageDialog { id: accountError