Skip to content

Commit

Permalink
Fixing session logout
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivanshVij committed Jan 30, 2023
1 parent 8a01445 commit f78847c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,11 @@ func (m *Controller) GetServiceSessionFromContext(ctx *fiber.Ctx) (*servicesessi
func (m *Controller) LogoutSession(ctx *fiber.Ctx) error {
cookie := ctx.Cookies(CookieKeyString)
if cookie != "" {
err := m.storage.DeleteSession(ctx.Context(), cookie)
sess, err := m.getSession(ctx, cookie)
if sess == nil {
return err
}
err = m.storage.DeleteSession(ctx.Context(), sess.ID)
if err != nil {
m.logger.Error().Err(err).Msg("failed to delete session")
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to delete session")
Expand Down

0 comments on commit f78847c

Please sign in to comment.