Convert backend/web from submodule to regular directory
This commit is contained in:
1 parent
102a316d42
commit
0010c92103
89 files changed
+6559
-1
No files matched your search
@@ -0,0 +1,105 @@
|
||||
<script lang="ts">
|
||||
import logo from "$lib/assets/logo-txt.png"
|
||||
import { auth, setToken } from '$lib/state/auth.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { authApi } from "$lib/api/endpoints/auth"
|
||||
|
||||
type Credentials = {
|
||||
email: string
|
||||
validemail: boolean
|
||||
password : string
|
||||
}
|
||||
|
||||
let credentials: Credentials = $state({
|
||||
email: "",
|
||||
password: "",
|
||||
validemail: false
|
||||
})
|
||||
|
||||
const formSubmitEmail = () => {
|
||||
credentials.validemail = true
|
||||
}
|
||||
|
||||
const formSubmitPass = (e: Event) => {
|
||||
e.preventDefault()
|
||||
authApi.login(credentials)
|
||||
.then((res)=>{
|
||||
auth.user = res.user
|
||||
setToken(res.accessToken)
|
||||
goto("/")
|
||||
})
|
||||
.catch((err)=>{
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="h-full w-full flex items-center public">
|
||||
<div class="m-auto w-96 max-w-full p-4">
|
||||
<img src={logo} class="h-10 mb-4" alt="logo"/>
|
||||
<h1>Identifiez-vous ...</h1>
|
||||
{#if !credentials.validemail}
|
||||
<form onsubmit={formSubmitEmail}>
|
||||
<div class="flex">
|
||||
<label for="email" class="block mb-2 flex-1">Email</label>
|
||||
<a href="/recover-password" class="text-xs">Mot de passe oublié ?</a>
|
||||
</div>
|
||||
<div class="flex flex-row">
|
||||
<input
|
||||
type="text"
|
||||
bind:value={credentials.email}
|
||||
class="textinput mr-1"
|
||||
autofocus
|
||||
/>
|
||||
<button class="bt" title="page suivante">
|
||||
<i class="icon-right-big"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="my-4 text-xs">
|
||||
<a href="/register">Pas encore de compte ? Incrivez-vous.</a>
|
||||
</div>
|
||||
|
||||
|
||||
{:else}
|
||||
<form onsubmit={formSubmitPass}>
|
||||
<div class="flex">
|
||||
<label for="email" class="block mb-2 flex-1">Mot de passe</label>
|
||||
</div>
|
||||
<div class="flex flex-row">
|
||||
<input
|
||||
type="password"
|
||||
bind:value={credentials.password}
|
||||
class="textinput mr-1"
|
||||
autofocus
|
||||
/>
|
||||
<button class="bt">
|
||||
Entrer
|
||||
</button>
|
||||
</div>
|
||||
<a href="/login" class="text-xs" onclick={()=>{credentials.validemail=false}}>← Retour</a>
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
<div class="grid grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-4">
|
||||
<button class="bt p-5 text-center" title="Connexion avec Google">
|
||||
<i class="icon-google"></i>
|
||||
</button>
|
||||
<button class="bt p-5 text-center" title="Connexion avec Facebook">
|
||||
<i class="icon-facebook"></i>
|
||||
</button>
|
||||
<button class="bt p-5 text-center" title="Connexion avec Github">
|
||||
<i class="icon-github"></i>
|
||||
</button>
|
||||
<button class="bt p-5 text-center" title="Connexion avec Apple">
|
||||
<i class="icon-apple"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user