mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
openalias: handle address validation correctly
This commit is contained in:
parent
7c0a557e62
commit
67787421e1
3 changed files with 12 additions and 12 deletions
|
@ -55,7 +55,7 @@ TextArea {
|
||||||
if(addressValidation){
|
if(addressValidation){
|
||||||
// js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }`
|
// 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);
|
var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype) || TxUtils.isValidOpenAliasAddress(textArea.text);
|
||||||
if(!address_ok) error = true;
|
if(!address_ok) error = true;
|
||||||
else error = false;
|
else error = false;
|
||||||
TextArea.cursorPosition = textArea.text.length;
|
TextArea.cursorPosition = textArea.text.length;
|
||||||
|
|
|
@ -56,3 +56,11 @@ function checkSignature(signature) {
|
||||||
return false;
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import moneroComponents.Wallet 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
import "../components" as MoneroComponents
|
import "../components" as MoneroComponents
|
||||||
import "." 1.0
|
import "." 1.0
|
||||||
|
import "../js/TxUtils.js" as TxUtils
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -51,15 +52,6 @@ Rectangle {
|
||||||
|
|
||||||
Clipboard { id: clipboard }
|
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) {
|
function oa_message(text) {
|
||||||
oaPopup.title = qsTr("OpenAlias error") + translationManager.emptyString
|
oaPopup.title = qsTr("OpenAlias error") + translationManager.emptyString
|
||||||
oaPopup.text = text
|
oaPopup.text = text
|
||||||
|
@ -249,8 +241,8 @@ Rectangle {
|
||||||
id: resolveButton
|
id: resolveButton
|
||||||
width: 80
|
width: 80
|
||||||
text: qsTr("Resolve") + translationManager.emptyString
|
text: qsTr("Resolve") + translationManager.emptyString
|
||||||
visible: isValidOpenAliasAddress(addressLine.text)
|
visible: TxUtils.isValidOpenAliasAddress(addressLine.text)
|
||||||
enabled : isValidOpenAliasAddress(addressLine.text)
|
enabled : visible
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var result = walletManager.resolveOpenAlias(addressLine.text)
|
var result = walletManager.resolveOpenAlias(addressLine.text)
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
Loading…
Reference in a new issue