fix: "logged in elsewhere" when logging in on account created via webui (#1800)
Reviewed-on: #1800 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
7a8b12b372
commit
948104a9a6
@ -21,7 +21,11 @@ export const loginController: RequestHandler = async (request, response) => {
|
||||
|
||||
const myAddress = request.host.indexOf("warframe.com") == -1 ? request.host : config.myAddress;
|
||||
|
||||
if (!account && config.autoCreateAccount && loginRequest.ClientType != "webui") {
|
||||
if (
|
||||
!account &&
|
||||
((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
|
||||
loginRequest.ClientType == "webui-register")
|
||||
) {
|
||||
try {
|
||||
const nameFromEmail = loginRequest.email.substring(0, loginRequest.email.indexOf("@"));
|
||||
let name = nameFromEmail || loginRequest.email.substring(1) || "SpaceNinja";
|
||||
@ -37,7 +41,7 @@ export const loginController: RequestHandler = async (request, response) => {
|
||||
password: loginRequest.password,
|
||||
DisplayName: name,
|
||||
CountryCode: loginRequest.lang.toUpperCase(),
|
||||
ClientType: loginRequest.ClientType,
|
||||
ClientType: loginRequest.ClientType == "webui-register" ? "webui" : loginRequest.ClientType,
|
||||
CrossPlatformAllowed: true,
|
||||
ForceLogoutVersion: 0,
|
||||
ConsentNeeded: false,
|
||||
@ -59,6 +63,11 @@ export const loginController: RequestHandler = async (request, response) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (loginRequest.ClientType == "webui-register") {
|
||||
response.status(400).json({ error: "account already exists" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isCorrectPassword(loginRequest.password, account.password)) {
|
||||
response.status(400).json({ error: "incorrect login data" });
|
||||
return;
|
||||
|
@ -13,6 +13,7 @@ function doLogin() {
|
||||
}
|
||||
|
||||
function loginFromLocalStorage() {
|
||||
const isRegister = registerSubmit;
|
||||
doLoginRequest(
|
||||
data => {
|
||||
if (single.getCurrentPath() == "/webui/") {
|
||||
@ -28,7 +29,7 @@ function loginFromLocalStorage() {
|
||||
},
|
||||
() => {
|
||||
logout();
|
||||
alert("Login failed");
|
||||
alert(isRegister ? "Registration failed. Account already exists?" : "Login failed");
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -44,7 +45,7 @@ function doLoginRequest(succ_cb, fail_cb) {
|
||||
s: "W0RFXVN0ZXZlIGxpa2VzIGJpZyBidXR0cw==", // signature of some kind
|
||||
lang: "en",
|
||||
date: 1501230947855458660, // ???
|
||||
ClientType: registerSubmit ? "" : "webui",
|
||||
ClientType: registerSubmit ? "webui-register" : "webui",
|
||||
PS: "W0RFXVN0ZXZlIGxpa2VzIGJpZyBidXR0cw==" // anti-cheat data
|
||||
})
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user