Skip to content

Show a sign-in code as two steps, each with its own action - #177

Merged
artyomsv merged 3 commits into
masterfrom
feat/sign-in-prompt-panel
Sep 25, 2026
Merged

artyomsv merged 3 commits into
masterfrom
feat/sign-in-prompt-panel

Conversation

@artyomsv

Copy link
Copy Markdown
Owner

Why

The prompted subscription sign-in panel showed a link, a code and a countdown in a plain column and
read as unfinished. The operator also asked for a copy button beside the code, and a button beside the
link that copies the code and opens the page.

What changed

  • New HarnessSignInCode: two numbered steps in the order they are used.
    1. Open the sign-in page — the link, plus an icon button that copies the code, then opens the
      page in a new tab (noopener,noreferrer). Copy comes first: a browser refuses a clipboard write
      once the new tab has focus.
    2. Enter this code — shown large and spaced, with a copy icon button.
  • A status line says what was just copied, or how long the code has left.
  • The link and its open button are offered only for an https address (second lock; the worker already
    accepts only the vendor host).
  • WIDGETS.md lists the new widget.

Verification

  • UI: 921 tests pass (4 new), TypeScript and production build pass.
  • Mutation checks: opening before copying, opening without copying, accepting a non-https address, and
    dropping noopener each fail a test.

The prompted sign-in panel was a link, a code and a countdown in a
column, and read as unfinished. It is now two numbered steps in the
order they are used:

1. Open the sign-in page - the link, with an icon button that copies
   the code and then opens the page in a new tab. Copying comes first
   because a browser refuses a clipboard write once the new tab has
   focus.
2. Enter this code - shown large and spaced, with a copy button.

A status line says what was just copied, or how long the code has
left. The link and its button are offered only for an https address.
Review of PR #177: both buttons said "Code copied" before the clipboard
write settled, so a refused or missing clipboard sent the operator to
paste whatever they had copied before.

Copy now reports the browser's answer: "copied" on success, and "could
not be copied - type it from here" when the write is refused or the API
is missing. The open button still starts the copy first and opens the
page in the same click - a window opened after waiting is blocked as a
pop-up - and reports the copy when it lands.
Second review of PR #177:

- The mounted flag was cleared by the first unmount of React's
  development StrictMode cycle and never set again, so every copy
  result was dropped in the dev build. It is now set on every mount.
- A copy failure never clears, and it was checked before expiry, so
  "type it from here" stayed on screen for a code that had run out.
  Expiry now wins.
@artyomsv
artyomsv merged commit 7b730e8 into master Sep 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant