feat: add break-glass user email update (#29256)

Adds an owner-only experimental API and hidden CLI command for
break-glass user email corrections.

The operation verifies the existing email, updates it transactionally,
clears outstanding password-reset state, revokes the target user's Coder
sessions and API tokens, and records successful and failed authenticated
attempts in the audit log. External-auth links remain unchanged.

Generated by Coder Agents.
This commit is contained in:
Cian Johnston authored and GitHub committed 2026-09-14 14:33:36 +01:00
1 parent 1321b41854
commit 2cf819bfca
19 files changed
+915

No files matched your search

+13
View File
@@ -396,6 +396,19 @@ SET
WHERE
id = $1;
-- name: UpdateUserEmail :one
UPDATE
users
SET
email = @new_email,
updated_at = @updated_at,
hashed_one_time_passcode = NULL,
one_time_passcode_expires_at = NULL
WHERE
LOWER(email) = LOWER(@old_email)
AND deleted = false
RETURNING *;
-- name: UpdateUserDeletedByID :exec
UPDATE
users