Merge pull request #1849

6778742 openalias: handle address validation correctly (mmbyday)
This commit is contained in:
luigi1111 2018-12-20 14:36:29 -06:00
commit 561ff356b8
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 12 additions and 12 deletions

View file

@ -55,7 +55,7 @@ TextArea {
if(addressValidation){
// js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }`
textArea.text = textArea.text.replace(/[^a-z0-9.@]/gi,'');
var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype);
var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype) || TxUtils.isValidOpenAliasAddress(textArea.text);
if(!address_ok) error = true;
else error = false;
TextArea.cursorPosition = textArea.text.length;

View file

@ -56,3 +56,11 @@ function checkSignature(signature) {
return false;
}
function isValidOpenAliasAddress(address) {
address = address.trim()
var dot = address.indexOf('.')
if (dot < 0)
return false
// we can get an awful lot of valid domains, including non ASCII chars... accept anything
return true
}

View file

@ -35,6 +35,7 @@ import moneroComponents.Wallet 1.0
import "../components"
import "../components" as MoneroComponents
import "." 1.0
import "../js/TxUtils.js" as TxUtils
Rectangle {
@ -51,15 +52,6 @@ Rectangle {
Clipboard { id: clipboard }
function isValidOpenAliasAddress(address) {
address = address.trim()
var dot = address.indexOf('.')
if (dot < 0)
return false
// we can get an awful lot of valid domains, including non ASCII chars... accept anything
return true
}
function oa_message(text) {
oaPopup.title = qsTr("OpenAlias error") + translationManager.emptyString
oaPopup.text = text
@ -249,8 +241,8 @@ Rectangle {
id: resolveButton
width: 80
text: qsTr("Resolve") + translationManager.emptyString
visible: isValidOpenAliasAddress(addressLine.text)
enabled : isValidOpenAliasAddress(addressLine.text)
visible: TxUtils.isValidOpenAliasAddress(addressLine.text)
enabled : visible
onClicked: {
var result = walletManager.resolveOpenAlias(addressLine.text)
if (result) {