mirror of
https://github.com/JonasunderscoreJones/dash.jonasjones.dev.git
synced 2025-10-24 14:19:20 +02:00
Compare commits
7 commits
53eeebaf0a
...
880a504eff
| Author | SHA1 | Date | |
|---|---|---|---|
| 880a504eff | |||
| 9bcaae01dd | |||
| bd7f0ae116 | |||
| 3f8bad7344 | |||
| df50ccfffb | |||
| 0ae6af7818 | |||
|
|
370fbdff52 |
4 changed files with 29 additions and 10 deletions
|
|
@ -1,10 +1,18 @@
|
|||
<script>
|
||||
export let expanded;
|
||||
</script>
|
||||
|
||||
<div class="alpha-notice">
|
||||
<h2><b>This is an Alpha Version</b></h2>
|
||||
<p>
|
||||
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
|
||||
<a href="https://github.com/JonasunderscoreJones/dash.jonasjones.dev/issues">GitHub repository</a>.
|
||||
</p>
|
||||
{#if expanded}
|
||||
<p>
|
||||
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
|
||||
<a href="https://github.com/JonasunderscoreJones/dash.jonasjones.dev/issues">GitHub repository</a>.
|
||||
</p>
|
||||
{:else}
|
||||
<a href="/about">More Info</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
<meta name="description" content="Svelte demo app" />
|
||||
</svelte:head>
|
||||
|
||||
<h2>Welcome to the Dashboard</h2>
|
||||
<div class="text-column">
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="text-column">
|
||||
<h1>About this Dashboard</h1>
|
||||
|
||||
<AlphaNotice />
|
||||
<AlphaNotice expanded={true} />
|
||||
|
||||
<p>
|
||||
This is a Dashboard app for my Ecosystem's services.
|
||||
|
|
|
|||
|
|
@ -15,13 +15,21 @@
|
|||
|
||||
const handleLogin = async () => {
|
||||
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', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, password }),
|
||||
body: JSON.stringify({ ...loginData, password }),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
if (data.sessionKey) {
|
||||
// Set session key as a cookie
|
||||
|
|
@ -51,7 +59,7 @@
|
|||
{/if}
|
||||
|
||||
<form on:submit|preventDefault={handleLogin}>
|
||||
<label for="email">Email:</label>
|
||||
<label for="email">Email or Username:</label>
|
||||
<input id="email" bind:value={email} required />
|
||||
|
||||
<label for="password">Password:</label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue