This commit is contained in:
Benjamin Toby
2025-02-19 20:01:50 +01:00
parent c08db13f3d
commit e9bb9fb07f
113 changed files with 253 additions and 63 deletions
+5 -3
View File
@@ -26,7 +26,7 @@ const debug_log_1 = __importDefault(require("../../utils/logging/debug-log"));
*/
function loginUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, }) {
var _b;
var _b, _c;
const grabedHostNames = (0, grab_host_names_1.default)({ userId: user_id || apiUserID });
const { host, port, scheme } = grabedHostNames;
const defaultTempLoginFieldName = "temp_login_code";
@@ -164,7 +164,9 @@ function loginUser(_a) {
if (token && encryptedPayload)
httpResponse["token"] = encryptedPayload;
}
catch (error) { }
catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Login User HTTP Response Error`, error);
}
const cookieNames = (0, get_auth_cookie_names_1.default)({
database,
userId: grabedHostNames.user_id,
@@ -183,7 +185,7 @@ function loginUser(_a) {
}
response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [
`${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Secure=true`,
`${csrfName}=${(_b = httpResponse.payload) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true`,
`${csrfName}=${(_c = httpResponse.payload) === null || _c === void 0 ? void 0 : _c.csrf_k};samesite=strict;path=/;HttpOnly=true`,
]);
if (debug) {
debugFn("Response Sent!");