From 316dfc1cb1574d7f8b1912dc0ace955ca021bfa1 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Tue, 12 Oct 2021 16:56:44 +0200 Subject: [PATCH] Improve validation message Signed-off-by: Alexis Sellier --- src/Form.svelte | 4 ++-- src/base/registrations/View.svelte | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Form.svelte b/src/Form.svelte index 4f3ac7c37..f50935380 100644 --- a/src/Form.svelte +++ b/src/Form.svelte @@ -12,7 +12,8 @@ } const validationTypes: { [index: string]: RegExp } = { - url: /^(https:\/\/|http:\/\/|ipfs:\/\/)\S+/, + URL: /^(https:\/\/|http:\/\/|ipfs:\/\/)\S+/, + URN: /^[a-z]+:[a-zA-Z0-9:-]{1,64}$/, // Github // Username may only contain alphanumeric characters or hyphens. // Username cannot have multiple consecutive hyphens. @@ -25,7 +26,6 @@ handle: /^[a-zA-Z0-9-_]{1,39}$/, address: /^0x[a-zA-Z0-9]{40}$/, id: /^[a-z0-9]+$/, - urn: /^[a-z]+:[a-zA-Z0-9:-]{1,64}$/, // Just make sure there is a TLD at the end. domain: /\.[a-z]{2,}$/, }; diff --git a/src/base/registrations/View.svelte b/src/base/registrations/View.svelte index 7ed2d0bb1..db5856ab2 100644 --- a/src/base/registrations/View.svelte +++ b/src/base/registrations/View.svelte @@ -66,10 +66,10 @@ + "a reverse record should be set." ), value: r.profile.address, editable: true }, - { name: "url", label: "URL", validate: "url", placeholder: "https://acme.org", + { name: "url", label: "URL", validate: "URL", placeholder: "https://acme.org", description: "A homepage or other URL associated with this name.", value: r.profile.url,editable: true }, - { name: "avatar", validate: "url", placeholder: "https://acme.org/avatar.png", + { name: "avatar", validate: "URL", placeholder: "https://acme.org/avatar.png", description: "An avatar or square image associated with this name.", value: r.profile.avatar, editable: true }, { name: "twitter", validate: "handle", placeholder: "Twitter username, eg. 'acme'", @@ -86,7 +86,7 @@ { name: "seed.id", label: "Seed ID", validate: "id", placeholder: "hynkyndc6w3p8urucakobzncqny7xxtw88...", description: "The Device ID of a Radicle Link node that hosts entities associated with this name.", value: r.profile.seedId, editable: true }, - { name: "anchors", label: "Anchors", validate: "urn", placeholder: "URN, eg. eip155:1:0x4a9cf21...", + { name: "anchors", label: "Anchors", validate: "URN", placeholder: "URN, eg. eip155:1:0x4a9cf21...", description: "URN under which associated project anchors can be found. " + "To point to a Radicle org on Ethereum, use the CAIP-10 ID, eg. *eip155:1:0x4a9cf21...*", value: r.profile.anchorsAccount, editable: true },