feat: label session actuelle + fix bouton révoquer
- GetSessions: retourne is_current=true pour la session correspondant au cookie courant - GetSessions: select token_hash pour la comparaison (non exposé dans le JSON) - profile.html: badge "Session actuelle" + désactive révoquer pour la session courante (utiliser le bouton Déconnexion à la place) - app.js: revokeSession utilise finally pour reset + isRevoking() helper - pages.css: styles .badge-current + .session-current Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1cbd7e9d17
commit
98cdabf3e1
4 changed files with 40 additions and 14 deletions
|
|
@ -670,7 +670,7 @@ document.addEventListener('alpine:init', () => {
|
|||
},
|
||||
|
||||
async revokeSession(id) {
|
||||
this.revoking = { ...this.revoking, [id]: true }
|
||||
this.revoking[id] = true
|
||||
try {
|
||||
const res = await apiFetch(`/api/auth/sessions/${id}`, { method: 'DELETE' })
|
||||
if (res.ok) {
|
||||
|
|
@ -682,10 +682,13 @@ document.addEventListener('alpine:init', () => {
|
|||
}
|
||||
} catch (e) {
|
||||
Alpine.store('toasts').error(`Erreur réseau — ${e.message}`)
|
||||
} finally {
|
||||
this.revoking[id] = false
|
||||
}
|
||||
this.revoking = { ...this.revoking, [id]: false }
|
||||
},
|
||||
|
||||
isRevoking(id) { return this.revoking[id] === true },
|
||||
|
||||
formatDate(raw) {
|
||||
if (!raw) return '—'
|
||||
// SQLite retourne "YYYY-MM-DD HH:MM:SS" ou RFC3339 selon le driver
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue