diff options
| author | Adam Soltys <[email protected]> | 2024-06-22 11:14:50 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-06-22 11:14:50 -0700 |
| commit | ffc5446a71854fdbb585245f6d7c15f4a81386ab (patch) | |
| tree | 3aabff62e511aab0a135ca928109e22645abf1fe /src | |
| parent | cc6ef7b76b7a7bb2f7b0c4c1a35dd80d3b3e13a1 (diff) | |
| download | coinos-ui-ffc5446a71854fdbb585245f6d7c15f4a81386ab.tar.gz coinos-ui-ffc5446a71854fdbb585245f6d7c15f4a81386ab.zip | |
strip spaces from usernames
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+layout.svelte | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 83c46c27..e3c36417 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -15,19 +15,20 @@ $: ({ events, user, subject, src, rates, text } = data); $: ({ currency, username: n, display } = subject); - $: username = n.length > 60 ? n.substr(0, 6) : display || n; + $: stripped = n.replace(/\s/g, "") + $: username = n.length > 60 ? n.substr(0, 6) : display || stripped; $: npub = subject.pubkey && bech32m.encode("npub", toWords(hexToUint8Array(subject.pubkey)), 180); - $: lnaddr = `${n}@${$page.url.host}`; - $: profile = `${$page.url.host}/${n}`; + $: lnaddr = `${stripped}@${$page.url.host}`; + $: profile = `${$page.url.host}/${stripped}`; let follow = async () => { user.follows.push([ "p", subject.pubkey, "wss://nostr.coinos.io", - subject.username, + stripped, ]); update(); }; @@ -67,7 +68,7 @@ let reset = async () => { try { - await post(`/${subject.username}/reset`, { password }); + await post(`/${stripped}/reset`, { password }); success("Password reset"); } catch (e) { fail(e.message); |
