feat: 更新 OAuth 流程中的日志信息,增强密码缺失时的处理逻辑,添加相关测试

This commit is contained in:
QLHazyCoder
2026-04-20 01:05:09 +08:00
parent da7cddee8f
commit 0d0cf4b2af
4 changed files with 232 additions and 9 deletions
+10 -2
View File
@@ -1913,10 +1913,18 @@ async function step6SwitchToOneTimeCodeLogin(snapshot) {
async function step6LoginFromPasswordPage(payload, snapshot) {
const currentSnapshot = normalizeStep6Snapshot(snapshot || inspectLoginAuthState());
const hasPassword = Boolean(String(payload?.password || '').trim());
if (currentSnapshot.passwordInput) {
if (!payload.password) {
throw new Error('登录时缺少密码,步骤 7 无法继续。');
if (!hasPassword) {
if (currentSnapshot.switchTrigger) {
log('步骤 7:当前未提供密码,改走一次性验证码登录。', 'warn');
return step6SwitchToOneTimeCodeLogin(currentSnapshot);
}
return createStep6RecoverableResult('missing_password_and_one_time_code_trigger', currentSnapshot, {
message: '登录时未提供密码,且当前页面没有可用的一次性验证码登录入口。',
});
}
log('步骤 7:已进入密码页,准备填写密码...');