Skip to content

Commit

Permalink
HOTFIX Logout
Browse files Browse the repository at this point in the history
  • Loading branch information
EtanoloYT committed Feb 11, 2025
1 parent a35c5ff commit 951b2b1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/controllers/auth_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,9 @@ export default class AuthController {
}
}

public async logout({ request, response }: { request: any; response: any }) {
public async logout({ response }: { response: any }) {
try {
const token = request.header('Authorization').replace('Bearer ', '')

// Aggiungi il token alla blacklist
const blacklistedToken = new TokenBlacklist({ token })
await blacklistedToken.save()

await response.clearCookie('token')
return response.status(200).json({ message: 'Logout effettuato con successo' })
} catch (error) {
return response.status(500).json({ message: 'Errore durante il logout' })
Expand Down

0 comments on commit 951b2b1

Please sign in to comment.