mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: improve error handling and display for login failures
This commit is contained in:
@@ -62,7 +62,13 @@
|
|||||||
}
|
}
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
} else {
|
} else {
|
||||||
error = 'Invalid username or password';
|
const resData = await res.json();
|
||||||
|
if (resData.errors) {
|
||||||
|
const messages = Object.values(resData.errors).flat();
|
||||||
|
error = messages.join('\n');
|
||||||
|
} else {
|
||||||
|
error = resData.message || 'Login failed. Please try again.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -101,7 +107,9 @@
|
|||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
{#if error}
|
{#if error}
|
||||||
<div class="rounded border border-red-900 bg-red-950 p-2 text-sm text-red-200">
|
<div
|
||||||
|
class="rounded border border-red-900 bg-red-950 p-2 text-sm whitespace-pre-line text-red-200"
|
||||||
|
>
|
||||||
{error}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user