MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / requestVerificationCodeResend

Function requestVerificationCodeResend

background/verification-flow.js:91–130  ·  view source on GitHub ↗
(step)

Source from the content-addressed store, hash-verified

89 }
90
91 async function requestVerificationCodeResend(step) {
92 throwIfStopped();
93 const signupTabId = await getTabId('signup-page');
94 if (!signupTabId) {
95 throw new Error('认证页面标签页已关闭,无法重新请求验证码。');
96 }
97
98 throwIfStopped();
99 await chrome.tabs.update(signupTabId, { active: true });
100 throwIfStopped();
101
102 const result = await sendToContentScript('signup-page', {
103 type: 'RESEND_VERIFICATION_CODE',
104 step,
105 source: 'background',
106 payload: {},
107 });
108
109 if (result && result.error) {
110 throw new Error(result.error);
111 }
112
113 await addLog(`步骤 ${step}:已请求新的${getVerificationCodeLabel(step)}验证码。`, 'warn');
114
115 const requestedAt = Date.now();
116 if (step === 7) {
117 await setState({ loginVerificationRequestedAt: requestedAt });
118 }
119
120 const currentState = await getState();
121 if (currentState.mailProvider === '2925') {
122 const mailTabId = await getTabId('mail-2925');
123 if (mailTabId) {
124 await chrome.tabs.update(mailTabId, { active: true });
125 await addLog(`步骤 ${step}:已切换到 2925 邮箱标签页等待新邮件。`, 'info');
126 }
127 }
128
129 return requestedAt;
130 }
131
132 async function pollFreshVerificationCodeWithResendInterval(step, state, mail, pollOverrides = {}) {
133 const stateKey = getVerificationCodeStateKey(step);

Calls 7

setStateFunction · 0.85
getStateFunction · 0.85
getTabIdFunction · 0.70
sendToContentScriptFunction · 0.70
addLogFunction · 0.70
getVerificationCodeLabelFunction · 0.70
throwIfStoppedFunction · 0.50

Tested by

no test coverage detected