修复IPv6插件的逻辑错误
Some checks failed
build / build (api, amd64, linux) (push) Failing after -50s
build / build (api, arm64, linux) (push) Failing after -51s
build / build (api.exe, amd64, windows) (push) Failing after -51s

This commit is contained in:
CN-JS-HuiBai
2026-04-18 11:18:36 +08:00
parent 98379b21f4
commit def8352bbb
4 changed files with 218 additions and 147 deletions

View File

@@ -1069,12 +1069,17 @@
saveToken(payload.auth_data);
state.authToken = getStoredToken();
// Try IPv6 login/register if email/password available
if (data.email && data.password) {
showMessage(formType === "register" ? "Account created" : "Signed in", "success");
return loadDashboard(true).then(function () {
if (formType !== "login" || !data.email || !data.password || state.ipv6AuthToken) {
return null;
}
if (!(state.ipv6Eligibility && state.ipv6Eligibility.is_active)) {
return null;
}
var ipv6Email = data.email.replace("@", "-ipv6@");
var ipv6Action = formType === "register" ? "/api/v1/passport/auth/register" : "/api/v1/passport/auth/login";
fetchJson(ipv6Action, {
return fetchJson("/api/v1/passport/auth/login", {
method: "POST",
auth: false,
body: Object.assign({}, data, { email: ipv6Email })
@@ -1085,14 +1090,11 @@
state.ipv6AuthToken = getStoredIpv6Token();
}
}).catch(function () {
// Ignore IPv6 errors as it might not be enabled yet or fail
}).finally(function() {
loadDashboard(true).then(render);
return null;
}).then(function () {
return loadDashboard(true);
});
}
showMessage(formType === "register" ? "Account created" : "Signed in", "success");
return loadDashboard(true);
});
}).then(render).catch(function (error) {
showMessage(error.message || "Unable to continue", "error");
render();