2 Commits

Author SHA1 Message Date
9116a1544e Merge branch 'fix-SSR-with-PB' into feat/gestion-utilisateur
Some checks failed
Build Docker Image / run (pull_request) Failing after 31s
2024-04-26 16:25:19 +02:00
5f642a6aa0 feat/ login on est pas mal 2024-04-26 16:25:04 +02:00
3 changed files with 18 additions and 4 deletions

View File

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

View File

@ -24,13 +24,11 @@ const res = await AstroUtils.wrap(async () => {
}
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) {
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')
---