mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: delete API token in /logout API (#1770)
* delete API token in logout api * add deleteapikeybyid to databasefake * set blank cookie on logout always * refactor logout flow, add unit tests * update logout messsage * use read-only file mode for windows * fix file mode on windows for cleanup * change file permissions on windows * assert error is not nil * refactor cli * try different file mode on windows * try different file mode on windows * try keeping the files open on Windows * fix the error message on Windows
This commit is contained in:
@@ -15,6 +15,19 @@ import (
|
||||
"github.com/tabbed/pqtype"
|
||||
)
|
||||
|
||||
const deleteAPIKeyByID = `-- name: DeleteAPIKeyByID :exec
|
||||
DELETE
|
||||
FROM
|
||||
api_keys
|
||||
WHERE
|
||||
id = $1
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) DeleteAPIKeyByID(ctx context.Context, id string) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteAPIKeyByID, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const getAPIKeyByID = `-- name: GetAPIKeyByID :one
|
||||
SELECT
|
||||
id, hashed_secret, user_id, last_used, expires_at, created_at, updated_at, login_type, oauth_access_token, oauth_refresh_token, oauth_id_token, oauth_expiry
|
||||
|
||||
Reference in New Issue
Block a user