Skip to content

Commit

Permalink
fix session revocation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Aug 9, 2024
1 parent 1c65c64 commit 072d4e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routes/auth/endpoints/revoke_session/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (

func Docs() *docs.Doc {
return &docs.Doc{
Summary: "Revoke User Session",
Description: "Revokes a session of a user based on session ID",
Summary: "Revoke Session",
Description: "Revokes a session of an entity based on session ID",
Resp: types.ApiError{},
Params: []docs.Parameter{
{
Expand Down Expand Up @@ -61,7 +61,7 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {

var count int64

err := state.Pool.QueryRow(d.Context, "SELECT COUNT(*) FROM api_sessions WHERE user_id = $1 AND id = $2", d.Auth.ID, sessionId).Scan(&count)
err := state.Pool.QueryRow(d.Context, "SELECT COUNT(*) FROM api_sessions WHERE target_type = $1 AND target_id = $2 AND id = $3", d.Auth.TargetType, d.Auth.ID, sessionId).Scan(&count)

if errors.Is(err, pgx.ErrNoRows) {
return uapi.HttpResponse{
Expand Down

0 comments on commit 072d4e5

Please sign in to comment.