feat: 添加邮箱验证码页面检测及日志记录,优化验证码输入流程
This commit is contained in:
@@ -166,6 +166,10 @@ function findResendVerificationCodeTrigger({ allowDisabled = false } = {}) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEmailVerificationPage() {
|
||||||
|
return /\/email-verification(?:[/?#]|$)/i.test(location.pathname || '');
|
||||||
|
}
|
||||||
|
|
||||||
async function prepareLoginCodeFlow(timeout = 15000) {
|
async function prepareLoginCodeFlow(timeout = 15000) {
|
||||||
const readyTarget = getVerificationCodeTarget();
|
const readyTarget = getVerificationCodeTarget();
|
||||||
if (readyTarget) {
|
if (readyTarget) {
|
||||||
@@ -173,10 +177,16 @@ async function prepareLoginCodeFlow(timeout = 15000) {
|
|||||||
return { ready: true, mode: readyTarget.type };
|
return { ready: true, mode: readyTarget.type };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isEmailVerificationPage() && isVerificationPageStillVisible()) {
|
||||||
|
log('步骤 7:已进入邮箱验证码页面,正在等待验证码输入框或重发入口稳定。');
|
||||||
|
return { ready: true, mode: 'verification_page' };
|
||||||
|
}
|
||||||
|
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
let switchClickCount = 0;
|
let switchClickCount = 0;
|
||||||
let lastSwitchAttemptAt = 0;
|
let lastSwitchAttemptAt = 0;
|
||||||
let loggedPasswordPage = false;
|
let loggedPasswordPage = false;
|
||||||
|
let loggedVerificationPage = false;
|
||||||
|
|
||||||
while (Date.now() - start < timeout) {
|
while (Date.now() - start < timeout) {
|
||||||
throwIfStopped();
|
throwIfStopped();
|
||||||
@@ -187,6 +197,15 @@ async function prepareLoginCodeFlow(timeout = 15000) {
|
|||||||
return { ready: true, mode: target.type };
|
return { ready: true, mode: target.type };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isEmailVerificationPage() && isVerificationPageStillVisible()) {
|
||||||
|
if (!loggedVerificationPage) {
|
||||||
|
loggedVerificationPage = true;
|
||||||
|
log('步骤 7:页面已进入邮箱验证码流程,继续等待验证码输入框渲染...');
|
||||||
|
}
|
||||||
|
await sleep(250);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const passwordInput = document.querySelector('input[type="password"]');
|
const passwordInput = document.querySelector('input[type="password"]');
|
||||||
const switchTrigger = findOneTimeCodeLoginTrigger();
|
const switchTrigger = findOneTimeCodeLoginTrigger();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user