mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
fix openalias resolve
This commit is contained in:
parent
b4353a31ac
commit
b38729fc0e
2 changed files with 47 additions and 33 deletions
|
@ -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;
|
||||
|
|
|
@ -257,40 +257,8 @@ Rectangle {
|
|||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
|
||||
+ 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 {
|
||||
|
|
Loading…
Reference in a new issue