From b38729fc0efc2ac924752525184cbf63446c3508 Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Sat, 21 Apr 2018 21:48:31 -0400 Subject: [PATCH] fix openalias resolve --- components/InputMulti.qml | 2 +- pages/Transfer.qml | 78 +++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/components/InputMulti.qml b/components/InputMulti.qml index 5698dcc6..5e9d2a0a 100644 --- a/components/InputMulti.qml +++ b/components/InputMulti.qml @@ -58,7 +58,7 @@ TextArea { onTextChanged: { if(addressValidation){ // js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }` - textArea.text = textArea.text.replace(/[^a-z0-9]/gi,''); + textArea.text = textArea.text.replace(/[^a-z0-9.@]/gi,''); var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype); if(!address_ok) error = true; else error = false; diff --git a/pages/Transfer.qml b/pages/Transfer.qml index d572e315..fd609736 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -257,40 +257,8 @@ Rectangle { labelText: qsTr("\ Address ( Address book )") + translationManager.emptyString - labelButtonText: qsTr("Resolve") + translationManager.emptyString placeholderText: "4.." onInputLabelLinkActivated: { appWindow.showPageRequest("AddressBook") } - onLabelButtonClicked: { - var result = walletManager.resolveOpenAlias(addressLine.text) - if (result) { - var parts = result.split("|") - if (parts.length == 2) { - var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.nettype) - if (parts[0] === "true") { - if (address_ok) { - addressLine.text = parts[1] - addressLine.cursorPosition = 0 - } - else - oa_message(qsTr("No valid address found at this OpenAlias address")) - } else if (parts[0] === "false") { - if (address_ok) { - addressLine.text = parts[1] - addressLine.cursorPosition = 0 - oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed")) - } else { - oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed")) - } - } else { - oa_message(qsTr("Internal error")) - } - } else { - oa_message(qsTr("Internal error")) - } - } else { - oa_message(qsTr("No address found")) - } - } } StandardButton { @@ -306,6 +274,52 @@ Rectangle { } } + StandardButton { + id: resolveButton + anchors.left: parent.left + width: 80 + text: qsTr("Resolve") + translationManager.emptyString + visible: isValidOpenAliasAddress(addressLine.text) + enabled : isValidOpenAliasAddress(addressLine.text) + onClicked: { + var result = walletManager.resolveOpenAlias(addressLine.text) + if (result) { + var parts = result.split("|") + if (parts.length == 2) { + var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.testnet) + if (parts[0] === "true") { + if (address_ok) { + addressLine.text = parts[1] + addressLine.cursorPosition = 0 + } + else + oa_message(qsTr("No valid address found at this OpenAlias address")) + } + else if (parts[0] === "false") { + if (address_ok) { + addressLine.text = parts[1] + addressLine.cursorPosition = 0 + oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed")) + } + else + { + oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed")) + } + } + else { + oa_message(qsTr("Internal error")) + } + } + else { + oa_message(qsTr("Internal error")) + } + } + else { + oa_message(qsTr("No address found")) + } + } + } + RowLayout { // payment id input LineEdit {