feat(authctl): support password reset

This commit is contained in:
QiuSW
2026-07-29 08:43:35 +08:00
parent c69879650e
commit d62a4af401
13 changed files with 205 additions and 16 deletions
@@ -95,6 +95,24 @@ func (s *Store) SetUserActive(
return requireAffectedAuthResource(result, err)
}
func (s *Store) ResetUserPassword(
ctx context.Context,
username string,
passwordHash string,
updatedAt time.Time,
) error {
result, err := s.db.ExecContext(
ctx,
`UPDATE users
SET password_hash = ?, updated_at = ?
WHERE username = ?`,
passwordHash,
formatTimestamp(updatedAt),
username,
)
return requireAffectedAuthResource(result, err)
}
func (s *Store) SetDeviceEnabled(
ctx context.Context,
deviceID string,