feat: login conflict #1127

Merged
Sainan merged 2 commits from login-conflict into main 2025-03-09 07:40:37 -07:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit eedb9e3137 - Show all commits

View File

@ -59,10 +59,19 @@ export const loginController: RequestHandler = async (request, response) => {
return; 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; account.Nonce = nonce;
}
if (loginRequest.ClientType != "webui") {
account.CountryCode = loginRequest.lang.toUpperCase(); account.CountryCode = loginRequest.lang.toUpperCase();
} }
await account.save(); await account.save();

View File

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