Compare commits

..

No commits in common. "880a504effc537ba144bce1f9f6ed7e181e04cca" and "53eeebaf0aa9dc7fcb68883db8f7c841617a2c89" have entirely different histories.

4 changed files with 10 additions and 29 deletions

View file

@ -1,18 +1,10 @@
<script>
export let expanded;
</script>
<div class="alpha-notice"> <div class="alpha-notice">
<h2><b>This is an Alpha Version</b></h2> <h2><b>This is an Alpha Version</b></h2>
{#if expanded} <p>
<p> Note that this Dashboard is in an alpha state. This means that there are bugs and missing features.
Note that this Dashboard is in an alpha state. This means that there are bugs and missing features. Please report any bugs or issues to the
Please report any bugs or issues to the <a href="https://github.com/JonasunderscoreJones/dash.jonasjones.dev/issues">GitHub repository</a>.
<a href="https://github.com/JonasunderscoreJones/dash.jonasjones.dev/issues">GitHub repository</a>. </p>
</p>
{:else}
<a href="/about">More Info</a>
{/if}
</div> </div>
<style> <style>

View file

@ -11,9 +11,6 @@
<meta name="description" content="Svelte demo app" /> <meta name="description" content="Svelte demo app" />
</svelte:head> </svelte:head>
<div class="text-column"> <h2>Welcome to the Dashboard</h2>
<h2>Welcome to the Dashboard</h2>
<p>You are logged in and have access to this page.</p> <p>You are logged in and have access to this page.</p>
<img src="https://cdn.tw25.net/img/jonrefs/party.gif" alt="Bouncy Jonrefs">
</div>

View file

@ -10,7 +10,7 @@
<div class="text-column"> <div class="text-column">
<h1>About this Dashboard</h1> <h1>About this Dashboard</h1>
<AlphaNotice expanded={true} /> <AlphaNotice />
<p> <p>
This is a Dashboard app for my Ecosystem's services. This is a Dashboard app for my Ecosystem's services.

View file

@ -15,21 +15,13 @@
const handleLogin = async () => { const handleLogin = async () => {
try { try {
// Check if email is a valid email address
const isValidEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
// If it's not a valid email, rename it to 'username'
const loginData = isValidEmail ? { email } : { username: email };
// Make the fetch request with either 'email' or 'username'
const response = await fetch(ACCOUNTS_WORKER_URL + '/login', { const response = await fetch(ACCOUNTS_WORKER_URL + '/login', {
method: 'POST', method: 'POST',
body: JSON.stringify({ ...loginData, password }), body: JSON.stringify({ email, password }),
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}); });
const data = await response.json(); const data = await response.json();
if (data.sessionKey) { if (data.sessionKey) {
// Set session key as a cookie // Set session key as a cookie
@ -59,7 +51,7 @@
{/if} {/if}
<form on:submit|preventDefault={handleLogin}> <form on:submit|preventDefault={handleLogin}>
<label for="email">Email or Username:</label> <label for="email">Email:</label>
<input id="email" bind:value={email} required /> <input id="email" bind:value={email} required />
<label for="password">Password:</label> <label for="password">Password:</label>