From 9e5688609e89a3a6cc25f7e60a431729f1ad5bdb Mon Sep 17 00:00:00 2001 From: 0xYYBB | ZYY | Bobo <128128010+the-dev-z@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:37:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20improve=20two-stage=20private=20key=20in?= =?UTF-8?q?put=20UX=20(32+32=20=E2=86=92=2058+6=20split)=20(#942)=20##=20P?= =?UTF-8?q?roblem=20Users=20reported=20that=20the=2032+32=20character=20sp?= =?UTF-8?q?lit=20design=20is=20not=20user-friendly:=201.=20=E2=9D=8C=20Sec?= =?UTF-8?q?ond=20stage=20still=20requires=20entering=2032=20characters=20-?= =?UTF-8?q?=20hard=20to=20count=202.=20=E2=9D=8C=20Need=20to=20count=20man?= =?UTF-8?q?y=20characters=20in=20both=20stages=203.=20=E2=9D=8C=20Easy=20t?= =?UTF-8?q?o=20make=20mistakes=20when=20counting=20##=20Solution=20Change?= =?UTF-8?q?=20the=20split=20from=2032+32=20to=20**58+6**=20**Stage=201**:?= =?UTF-8?q?=2058=20characters=20-=20Enter=20the=20majority=20of=20the=20ke?= =?UTF-8?q?y=20(90%)=20-=20Easy=20to=20copy/paste=20the=20prefix=20**Stage?= =?UTF-8?q?=202**:=206=20characters=20-=20=E2=9C=85=20Only=20need=20to=20c?= =?UTF-8?q?ount=20last=206=20chars=20(very=20easy)=20-=20=E2=9C=85=20Quick?= =?UTF-8?q?=20verification=20of=20key=20suffix=20-=20=E2=9C=85=20Reduces?= =?UTF-8?q?=20user=20errors=20##=20Changes=20```typescript=20//=20Old:=20E?= =?UTF-8?q?qual=20split=20const=20expectedPart1Length=20=3D=20Math.ceil(ex?= =?UTF-8?q?pectedLength=20/=202)=20=20//=2032=20const=20expectedPart2Lengt?= =?UTF-8?q?h=20=3D=20expectedLength=20-=20expectedPart1Length=20=20//=2032?= =?UTF-8?q?=20//=20New:=20Most=20of=20key=20+=20last=206=20chars=20const?= =?UTF-8?q?=20expectedPart1Length=20=3D=20expectedLength=20-=206=20=20//?= =?UTF-8?q?=2058=20const=20expectedPart2Length=20=3D=206=20=20//=20Last=20?= =?UTF-8?q?6=20characters=20```=20##=20Test=20plan=20=E2=9C=85=20Frontend?= =?UTF-8?q?=20builds=20successfully=20(npm=20run=20build)=20=E2=9C=85=20Us?= =?UTF-8?q?er-friendly:=20Only=20need=20to=20count=206=20characters=20?= =?UTF-8?q?=E2=9C=85=20Maintains=20security:=20Two-stage=20input=20logic?= =?UTF-8?q?=20unchanged=20Co-authored-by:=20the-dev-z=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/TwoStageKeyModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/components/TwoStageKeyModal.tsx b/web/src/components/TwoStageKeyModal.tsx index 70e0f478..d960b28a 100644 --- a/web/src/components/TwoStageKeyModal.tsx +++ b/web/src/components/TwoStageKeyModal.tsx @@ -63,8 +63,10 @@ export function TwoStageKeyModal({ const stage1Ref = useRef(null) const stage2Ref = useRef(null) - const expectedPart1Length = Math.ceil(expectedLength / 2) - const expectedPart2Length = expectedLength - expectedPart1Length + // UX improvement: Use 58 + 6 split (most of the key + last 6 chars) + // Advantage: Second stage only requires entering 6 characters, much easier to count + const expectedPart1Length = expectedLength - 6 // 64 - 6 = 58 + const expectedPart2Length = 6 // Last 6 characters useEffect(() => { if (isOpen && stage === 1 && stage1Ref.current) {