feat: gestion-utilisateur #1

Merged
Clement merged 37 commits from feat/gestion-utilisateur into master 2024-05-20 10:48:35 +00:00
3 changed files with 18 additions and 4 deletions
Showing only changes of commit 5f642a6aa0 - Show all commits

View File

@ -15,4 +15,7 @@ if(!auth.isValid){
<Layout title="Account setting"> <Layout title="Account setting">
<h1>Bonjour {user!.name}</h1> <h1>Bonjour {user!.name}</h1>
<div>
<a href="/account/logout">deconnexion</a>
</div>
</Layout> </Layout>

View File

@ -24,13 +24,11 @@ const res = await AstroUtils.wrap(async () => {
} }
try { try {
await locals.pb.collection('users').authWithPassword(request.user,request.password); pb.collection('users').authWithPassword(request.user,request.password);
return Astro.redirect("/account")
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
return Astro.redirect("/account")
}) })
--- ---

View File

@ -0,0 +1,13 @@
---
import PocketBase from 'pocketbase'
const pb = Astro.locals.pb as PocketBase
if(pb.authStore.isValid){
pb.authStore.clear()
}
return Astro.redirect('/account/login')
---