feat: gestion-utilisateur #1
@ -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>
|
||||||
|
@ -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")
|
|
||||||
|
|
||||||
})
|
})
|
||||||
---
|
---
|
||||||
|
|
||||||
|
13
front/src/pages/account/logout.astro
Normal file
13
front/src/pages/account/logout.astro
Normal 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')
|
||||||
|
|
||||||
|
---
|
Loading…
x
Reference in New Issue
Block a user