feat: login conflict

This commit is contained in:
Sainan 2025-03-09 10:07:27 +01:00
parent 92d53e1c00
commit eedb9e3137
2 changed files with 13 additions and 3 deletions

View File

@ -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();

View File

@ -32,6 +32,7 @@ export interface ILoginRequest {
date: number;
ClientType: string;
PS: string;
kick?: boolean;
}
export interface ILoginResponse extends IAccountAndLoginResponseCommons {