diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index f01c405a..565bebf0 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -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; diff --git a/static/webui/script.js b/static/webui/script.js index 7868e189..e4d0ed92 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -44,7 +44,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 }) });