From 41d3f700b93aa3a0fdce254cba0be9915de0c567 Mon Sep 17 00:00:00 2001 From: libr Date: Tue, 3 Mar 2026 15:30:28 +0800 Subject: [PATCH] feat: add two-factor authentication modal and handling --- frontend/src/apple-signing.ts | 23 +++---- frontend/src/main.ts | 113 +++++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 16 deletions(-) diff --git a/frontend/src/apple-signing.ts b/frontend/src/apple-signing.ts index 6e2c0b3..a081298 100644 --- a/frontend/src/apple-signing.ts +++ b/frontend/src/apple-signing.ts @@ -122,21 +122,16 @@ export async function loginAppleDeveloperAccount( password, request.anisetteData, (submitCode) => { - if (request.onTwoFactorRequired) { - request.onTwoFactorRequired((code) => { - const normalized = code.trim() - if (normalized.length === 0) { - throw new Error("2FA code is required") - } - submitCode(normalized) - }) - return + if (!request.onTwoFactorRequired) { + throw new Error("2FA required but no in-page handler provided") } - const code = window.prompt("Apple 2FA code") - if (!code || code.trim().length === 0) { - throw new Error("2FA code is required") - } - submitCode(code.trim()) + request.onTwoFactorRequired((code) => { + const normalized = code.trim() + if (normalized.length === 0) { + throw new Error("2FA code is required") + } + submitCode(normalized) + }) }, ) diff --git a/frontend/src/main.ts b/frontend/src/main.ts index d337760..daf5ff6 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -384,6 +384,20 @@ app.innerHTML = ` + +