c9c3b2b691
Closes #8305 The Clipboard API (`navigator.clipboard`) requires a secure context (HTTPS or localhost). Self-hosted deployments on plain HTTP silently fail when copying. This PR: - Adds a `document.execCommand('copy')` fallback for insecure contexts - Shows a descriptive error message explaining HTTPS is required when the fallback also fails - Consolidates 3 components that were using `navigator.clipboard` directly (without error handling) to use the centralized `useCopyToClipboard` hook Generated with [Claude Code](https://claude.ai/code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Scoped to frontend clipboard UX with a defensive fallback and clearer errors; minimal impact outside copy flows. > > **Overview** > Improves copy-to-clipboard behavior in non-HTTPS/self-hosted deployments by enhancing `useCopyToClipboard` to use `navigator.clipboard` only in secure contexts and otherwise fall back to `document.execCommand('copy')`. > > Updates 2FA setup screens and the view visibility dropdown to use the centralized `copyToClipboard` helper (with consistent snackbars), and shows a more descriptive error (longer duration) when copying fails due to an insecure context. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 30944e63eba720c30f2cad5829aadc7361e67e4c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>