fix: login failure on U16 (#1991)
Some checks failed
Build Docker image / docker (push) Has been cancelled
Build / build (push) Has been cancelled

Reviewed-on: #1991
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:
Sainan 2025-05-06 02:29:03 -07:00 committed by Sainan
parent 4e57bcd1ae
commit 460deed3ed
2 changed files with 11 additions and 8 deletions

View File

@ -41,7 +41,7 @@ export const loginController: RequestHandler = async (request, response) => {
email: loginRequest.email, email: loginRequest.email,
password: loginRequest.password, password: loginRequest.password,
DisplayName: name, DisplayName: name,
CountryCode: loginRequest.lang.toUpperCase(), CountryCode: loginRequest.lang?.toUpperCase() ?? "EN",
ClientType: loginRequest.ClientType == "webui-register" ? "webui" : loginRequest.ClientType, ClientType: loginRequest.ClientType == "webui-register" ? "webui" : loginRequest.ClientType,
CrossPlatformAllowed: true, CrossPlatformAllowed: true,
ForceLogoutVersion: 0, ForceLogoutVersion: 0,
@ -91,7 +91,7 @@ export const loginController: RequestHandler = async (request, response) => {
account.ClientType = loginRequest.ClientType; account.ClientType = loginRequest.ClientType;
account.Nonce = nonce; account.Nonce = nonce;
account.CountryCode = loginRequest.lang.toUpperCase(); account.CountryCode = loginRequest.lang?.toUpperCase() ?? "EN";
account.BuildLabel = buildLabel; account.BuildLabel = buildLabel;
} }
await account.save(); await account.save();
@ -107,10 +107,13 @@ const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, b
AmazonAuthToken: account.AmazonAuthToken, AmazonAuthToken: account.AmazonAuthToken,
AmazonRefreshToken: account.AmazonRefreshToken, AmazonRefreshToken: account.AmazonRefreshToken,
Nonce: account.Nonce, Nonce: account.Nonce,
IRC: config.myIrcAddresses ?? [myAddress],
NRS: config.NRS, NRS: config.NRS,
BuildLabel: buildLabel BuildLabel: buildLabel
}; };
if (version_compare(buildLabel, "2015.05.14.16.29") >= 0) {
// U17 and up
resp.IRC = config.myIrcAddresses ?? [myAddress];
}
if (version_compare(buildLabel, "2018.11.08.14.45") >= 0) { if (version_compare(buildLabel, "2018.11.08.14.45") >= 0) {
// U24 and up // U24 and up
resp.ConsentNeeded = account.ConsentNeeded; resp.ConsentNeeded = account.ConsentNeeded;

View File

@ -35,11 +35,11 @@ export interface ILoginRequest {
email: string; email: string;
password: string; password: string;
time: number; time: number;
s: string; s?: string;
lang: string; lang?: string;
date: number; date: number;
ClientType: string; ClientType?: string;
PS: string; PS?: string;
kick?: boolean; kick?: boolean;
} }
@ -51,7 +51,7 @@ export interface ILoginResponse extends IAccountAndLoginResponseCommons {
platformCDNs?: string[]; platformCDNs?: string[];
NRS?: string[]; NRS?: string[];
DTLS?: number; DTLS?: number;
IRC: string[]; IRC?: string[];
HUB?: string; HUB?: string;
} }