feat: automatic termination of older sessions on login (temporary until release 4);
fix: login controller method not returning tokens
This commit is contained in:
@@ -664,6 +664,18 @@ func (q *Queries) PruneTerminatedSessions(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const terminateAllSessionsForUserByUsername = `-- name: TerminateAllSessionsForUserByUsername :exec
|
||||
UPDATE sessions
|
||||
SET terminated = TRUE
|
||||
FROM users
|
||||
WHERE sessions.user_id = users.id AND users.username = $1::text
|
||||
`
|
||||
|
||||
func (q *Queries) TerminateAllSessionsForUserByUsername(ctx context.Context, username string) error {
|
||||
_, err := q.db.Exec(ctx, terminateAllSessionsForUserByUsername, username)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateBannedUser = `-- name: UpdateBannedUser :exec
|
||||
UPDATE banned_users
|
||||
SET
|
||||
|
||||
Reference in New Issue
Block a user