Skip to content

Commit ebfad8a

Browse files
committed
fix: remove device session when used
1 parent feb95a9 commit ebfad8a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

persistence/sql/persister_device.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,9 @@ func (p *Persister) InvalidateDeviceCodeSession(ctx context.Context, signature s
257257

258258
/* #nosec G201 table is static */
259259
return sqlcon.HandleError(
260-
p.Connection(ctx).
261-
RawQuery(
262-
fmt.Sprintf("UPDATE %s SET device_code_active=false WHERE device_code_signature=? AND nid = ?", sqlTableDeviceAuthCodes),
263-
signature,
264-
p.NetworkID(ctx),
265-
).
266-
Exec(),
267-
)
260+
p.QueryWithNetwork(ctx).
261+
Where("device_code_signature = ?", signature).
262+
Delete(DeviceRequestSQL{}))
268263
}
269264

270265
// GetUserCodeSession returns a user code session from the database

0 commit comments

Comments
 (0)