mirror of
https://github.com/monero-project/monero-gui
synced 2024-11-21 12:44:14 +01:00
Merge pull request #4243
e41f3cf
TxUtils: use regex to check for valid domain (selsta)
This commit is contained in:
commit
f284677c17
@ -70,11 +70,14 @@ 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
|
||||
|
||||
if (!regex.test(address)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lastPart = address.substring(address.lastIndexOf('.') + 1);
|
||||
return isNaN(parseInt(lastPart)) || lastPart !== parseInt(lastPart).toString();
|
||||
}
|
||||
|
||||
function handleOpenAliasResolution(address, descriptionText) {
|
||||
|
Loading…
Reference in New Issue
Block a user