diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index 5293641f..e0abb0a6 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -59,10 +59,19 @@ export const loginController: RequestHandler = async (request, response) => { return; } - if (account.Nonce == 0 || loginRequest.ClientType != "webui") { + if (loginRequest.ClientType == "webui") { + if (!account.Nonce) { + account.ClientType = "webui"; + account.Nonce = nonce; + } + } else { + if (account.Nonce && account.ClientType != "webui" && !loginRequest.kick) { + response.status(400).json({ error: "nonce still set" }); + return; + } + + account.ClientType = loginRequest.ClientType; account.Nonce = nonce; - } - if (loginRequest.ClientType != "webui") { account.CountryCode = loginRequest.lang.toUpperCase(); } await account.save(); diff --git a/src/types/loginTypes.ts b/src/types/loginTypes.ts index 687d611e..847dbfc2 100644 --- a/src/types/loginTypes.ts +++ b/src/types/loginTypes.ts @@ -32,6 +32,7 @@ export interface ILoginRequest { date: number; ClientType: string; PS: string; + kick?: boolean; } export interface ILoginResponse extends IAccountAndLoginResponseCommons {