修复IPv6插件的逻辑错误
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user