Skip to content

Commit

Permalink
(NOBIDS) purge all sessions after account deletion (#2487)
Browse files Browse the repository at this point in the history
* (NOBIDS) purge all sessions after account deletion

* (NOBIDS) using correct error log function

* (NOBIDS) separated parameters from error text
  • Loading branch information
remoterami authored Sep 4, 2023
1 parent c424be8 commit 5e0bda2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions handlers/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,13 @@ func UserDeletePost(w http.ResponseWriter, r *http.Request) {
}

Logout(w, r)
err = purgeAllSessionsForUser(r.Context(), user.UserID)
if err != nil {
utils.LogError(err, "error purging sessions for user", 0, map[string]interface{}{"userID": user.UserID})
utils.SetFlash(w, r, authSessionName, authInternalServerErrorFlashMsg)
http.Redirect(w, r, "/login", http.StatusSeeOther)
return
}
} else {
utils.LogError(nil, "Trying to delete an unauthenticated user", 0)
http.Redirect(w, r, "/user/settings", http.StatusSeeOther)
Expand Down

0 comments on commit 5e0bda2

Please sign in to comment.