Files
lucent-laravel/front/js/svelte/account/Login.svelte
T

69 lines
2.1 KiB
Svelte
Raw Normal View History

2023-10-02 23:10:49 +03:00
<script>
2026-05-06 23:16:09 +03:00
import { getContext } from "svelte";
import { apiPost } from "../../helpers";
2023-10-02 23:10:49 +03:00
const channel = getContext("channel");
let email = "";
2026-05-06 23:16:09 +03:00
let submitted = false;
2023-10-02 23:10:49 +03:00
function login(e) {
e.preventDefault();
2026-05-06 23:16:09 +03:00
apiPost(channel.lucentUrl + "/login", { email: email })
.then(() => {
submitted = true;
2023-10-02 23:10:49 +03:00
})
2026-05-06 23:16:09 +03:00
.catch(() => {});
2023-10-02 23:10:49 +03:00
}
</script>
2026-05-06 23:16:09 +03:00
<div class="scope-login">
<div class="bg-image"></div>
<div class="login-form">
{#if submitted}
<div class="alert alert-info" role="alert">
<p>
You will receive an email with a login link at <b>{email}</b
>.
</p>
<p>Check your spam folder</p>
2023-10-14 18:06:36 +03:00
</div>
2026-05-06 23:16:09 +03:00
{:else}
<div class="form">
<h2 class="mb-5">Enter Lucent</h2>
2023-10-14 18:06:36 +03:00
2026-05-06 23:16:09 +03:00
<form on:submit={login}>
<p>
Submit your email address and you will receive a <b
>login link</b
> to your email
</p>
<p>Don't forget to check your spam folder</p>
<div class="mt-5 mb-3">
<label for="emailaddress" class="form-label"
>Email address</label
>
<input
type="email"
bind:value={email}
class="form-control"
id="emailaddress"
required
/>
</div>
2023-10-14 18:06:36 +03:00
2026-05-06 23:16:09 +03:00
<button class="bt bt-primary">
Send email
<img
alt="indicator"
id="indicator"
class="htmx-indicator"
src="/img/spinner.svg"
/>
</button>
</form>
2023-10-14 18:06:36 +03:00
</div>
2026-05-06 23:16:09 +03:00
{/if}
</div>
2023-10-02 23:10:49 +03:00
</div>