diff --git a/web/cashtab/src/components/Tokens/CreateTokenForm.js b/web/cashtab/src/components/Tokens/CreateTokenForm.js --- a/web/cashtab/src/components/Tokens/CreateTokenForm.js +++ b/web/cashtab/src/components/Tokens/CreateTokenForm.js @@ -597,7 +597,7 @@ newTokenDocumentUrlIsValid === null || newTokenDocumentUrlIsValid ? '' - : 'Document URL cannot exceed 68 characters' + : 'Document URL cannot exceed 68 characters and must be a valid URL' } > { + const userInputConvertedToArray = tokenDocumentUrl.split('.'); + const userInputConvertedToArrayWithHttps = + tokenDocumentUrl.split('https://'); + const userInputConvertedToArrayWithHttp = tokenDocumentUrl.split('http://'); + const topLevelDomain = tokenDocumentUrl.split('.').pop(); return ( - typeof tokenDocumentUrl === 'string' && - tokenDocumentUrl.length >= 0 && - tokenDocumentUrl.length < 68 + (typeof tokenDocumentUrl === 'string' && + tokenDocumentUrl.length >= 0 && + tokenDocumentUrl.length < 68 && + topLevelDomain.length > 0 && + tokenDocumentUrl.includes('.') && + userInputConvertedToArrayWithHttps.length > 0 && + userInputConvertedToArrayWithHttp.length > 0 && + userInputConvertedToArray[0].includes('https://')) || + userInputConvertedToArray[0].includes('http://') ); };