This commit is contained in:
2025-12-26 06:37:30 +01:00
parent 98aaa94b80
commit b02399c64d
50 changed files with 112 additions and 105 deletions
@@ -20,7 +20,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
const COOKIE_EXPIRY_DATE = (0, grab_cookie_expirt_date_1.default)();
if (httpResponse === null || httpResponse === void 0 ? void 0 : httpResponse.success) {
let encryptedPayload = (0, encrypt_1.default)({
data: JSON.stringify(httpResponse.payload),
data: JSON.stringify(httpResponse.singleRes),
encryptionKey,
encryptionSalt,
});
@@ -35,8 +35,8 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
database,
});
if (httpResponse.csrf && !skipWriteAuthFile) {
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.payload), cleanupTokens && ((_a = httpResponse.payload) === null || _a === void 0 ? void 0 : _a.id)
? { userId: httpResponse.payload.id }
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.singleRes), cleanupTokens && ((_a = httpResponse.singleRes) === null || _a === void 0 ? void 0 : _a.id)
? { userId: httpResponse.singleRes.id }
: undefined);
}
httpResponse["cookieNames"] = cookieNames;
@@ -50,7 +50,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
}
response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [
`${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}${secureCookie ? ";Secure=true" : ""}`,
`${csrfName}=${(_b = httpResponse.payload) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
`${csrfName}=${(_b = httpResponse.singleRes) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
]);
if (debug) {
debugFn("Response Sent!");