frontend formatting login page
This commit is contained in:
@@ -1,94 +1,78 @@
|
|||||||
<script>
|
<script>
|
||||||
import { applyAction, enhance } from "$app/forms";
|
import { applyAction, enhance } from '$app/forms';
|
||||||
import { page } from "$app/stores";
|
import { page } from '$app/stores';
|
||||||
import { receive, send } from "$lib/utils/helpers";
|
import { receive, send } from '$lib/utils/helpers';
|
||||||
import { t } from "svelte-i18n";
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
/** @type {import('./$types').ActionData} */
|
/** @type {import('./$types').ActionData} */
|
||||||
export let form;
|
export let form;
|
||||||
|
|
||||||
/** @type {import('./$types').SubmitFunction} */
|
/** @type {import('./$types').SubmitFunction} */
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
return async ({ result }) => {
|
return async ({ result }) => {
|
||||||
await applyAction(result);
|
await applyAction(result);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
let message = "";
|
let message = '';
|
||||||
if ($page.url.searchParams.get("message")) {
|
if ($page.url.searchParams.get('message')) {
|
||||||
message = $page.url.search.split("=")[1].replaceAll("%20", " ");
|
message = $page.url.search.split('=')[1].replaceAll('%20', ' ');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form
|
<form class="content" method="POST" action="?/login" use:enhance={handleLogin}>
|
||||||
class="content"
|
<h1 class="step-title">{$t('user.login')}</h1>
|
||||||
method="POST"
|
{#if form?.errors}
|
||||||
action="?/login"
|
{#each form?.errors as error (error.id)}
|
||||||
use:enhance={handleLogin}
|
<h4
|
||||||
>
|
class="step-subtitle warning"
|
||||||
<h1 class="step-title">{$t("user.login")}</h1>
|
in:receive|global={{ key: error.id }}
|
||||||
{#if form?.errors}
|
out:send|global={{ key: error.id }}
|
||||||
{#each form?.errors as error (error.id)}
|
>
|
||||||
<h4
|
{$t(error.key)}
|
||||||
class="step-subtitle warning"
|
</h4>
|
||||||
in:receive|global={{ key: error.id }}
|
{/each}
|
||||||
out:send|global={{ key: error.id }}
|
{/if}
|
||||||
>
|
|
||||||
{$t(error.key)}
|
|
||||||
</h4>
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if message}
|
{#if message}
|
||||||
<h4 class="step-subtitle">{message}</h4>
|
<h4 class="step-subtitle">{message}</h4>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<input
|
<input type="hidden" name="next" value={$page.url.searchParams.get('next')} />
|
||||||
type="hidden"
|
<div class="input-box">
|
||||||
name="next"
|
<span class="label">{$t('user.email')}:</span>
|
||||||
value={$page.url.searchParams.get("next")}
|
<input class="input" type="email" name="email" placeholder="{$t('placeholder.email')} " />
|
||||||
/>
|
</div>
|
||||||
<div class="input-box">
|
<div class="input-box">
|
||||||
<span class="label">{$t("email")}:</span>
|
<span class="label">{$t('password')}:</span>
|
||||||
<input
|
<div class="input-wrapper">
|
||||||
class="input"
|
<input
|
||||||
type="email"
|
class="input"
|
||||||
name="email"
|
type="password"
|
||||||
placeholder="{$t('placeholder.email')} "
|
name="password"
|
||||||
/>
|
placeholder={$t('placeholder.password')}
|
||||||
</div>
|
/>
|
||||||
<div class="input-box">
|
<a href="/auth/password/request-change" class="forgot-password">{$t('forgot_password')}?</a>
|
||||||
<span class="label">{$t("password")}:</span>
|
</div>
|
||||||
<div class="input-wrapper">
|
</div>
|
||||||
<input
|
<div class="btn-container">
|
||||||
class="input"
|
<button class="button-dark">{$t('login')} </button>
|
||||||
type="password"
|
</div>
|
||||||
name="password"
|
</form>
|
||||||
placeholder={$t("placeholder.password")}
|
|
||||||
/>
|
|
||||||
<a href="/auth/password/request-change" class="forgot-password"
|
|
||||||
>{$t("forgot_password")}?</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="btn-container">
|
|
||||||
<button class="button-dark">{$t("login")} </button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.input-wrapper {
|
.input-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 444px;
|
max-width: 444px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.forgot-password {
|
.forgot-password {
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user