fix username handling with non A_Z

This commit is contained in:
Ruben Fiszel
2023-05-17 22:43:40 +02:00
parent a13d2832d4
commit 3b76280f30
2 changed files with 6 additions and 4 deletions
+6 -3
View File
@@ -77,14 +77,17 @@
export async function reset() {
if (path == '' || path == 'u//') {
if ($lastMetaUsed == undefined) {
if ($lastMetaUsed == undefined || $lastMetaUsed.owner != $userStore?.username) {
meta = {
ownerKind: 'user',
name: random_adj() + '_' + namePlaceholder,
owner: ''
}
meta.owner = $userStore!.username.split('@')[0].replace(/[^a-zA-Z0-9]/g, '')
if ($userStore?.username?.includes('@')) {
meta.owner = $userStore!.username.split('@')[0].replace(/[^a-zA-Z0-9_]/g, '')
} else {
meta.owner = $userStore!.username!
}
} else {
meta = { ...$lastMetaUsed, name: random_adj() + '_' + namePlaceholder }
}
@@ -143,7 +143,6 @@
<svelte:window bind:innerWidth />
<UserSettings bind:this={userSettings} />
{#if $page.status == 404}
<CenteredModal title="Page not found, redirecting you to login">
<div class="w-full">