Skip to content

Commit

Permalink
TxUtils: use regex to check for valid domain
Browse files Browse the repository at this point in the history
  • Loading branch information
selsta committed Nov 13, 2023
1 parent bea3032 commit 480bb1d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions js/TxUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ function checkSignature(signature) {
}

function isValidOpenAliasAddress(address) {
address = address.trim()
// we can get an awful lot of valid domains, including non ASCII chars... accept anything
// there should be something after the .
// make sure it is not some kind of floating number
return address.length > 2 && isNaN(parseFloat(address)) && address.indexOf('.') >= 0
var regex = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/; // Basic domain structure
return regex.test(address);
}

function handleOpenAliasResolution(address, descriptionText) {
Expand Down

0 comments on commit 480bb1d

Please sign in to comment.