Updates
This commit is contained in:
parent
9ea903a401
commit
8d855ce94d
@ -40,7 +40,9 @@ export default async function fetchApi(
|
|||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
let data;
|
let data;
|
||||||
|
|
||||||
const csrfValue = localStorage.getItem(localStorageCSRFKey || "csrf");
|
const csrfValue = localStorage.getItem(
|
||||||
|
localStorageCSRFKey || getCsrfHeaderName()
|
||||||
|
);
|
||||||
|
|
||||||
let finalHeaders = {
|
let finalHeaders = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
2
dist/client/fetch/index.js
vendored
2
dist/client/fetch/index.js
vendored
@ -23,7 +23,7 @@ function fetchApi(url, options, csrf,
|
|||||||
localStorageCSRFKey) {
|
localStorageCSRFKey) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let data;
|
let data;
|
||||||
const csrfValue = localStorage.getItem(localStorageCSRFKey || "csrf");
|
const csrfValue = localStorage.getItem(localStorageCSRFKey || (0, get_csrf_header_name_1.default)());
|
||||||
let finalHeaders = {
|
let finalHeaders = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
};
|
};
|
||||||
|
17
dist/package-shared/actions/users/user-auth.js
vendored
17
dist/package-shared/actions/users/user-auth.js
vendored
@ -10,7 +10,7 @@ const write_auth_files_1 = require("../../functions/backend/auth/write-auth-file
|
|||||||
const parseCookies_1 = __importDefault(require("../../utils/backend/parseCookies"));
|
const parseCookies_1 = __importDefault(require("../../utils/backend/parseCookies"));
|
||||||
const get_csrf_header_name_1 = __importDefault(require("../../actions/get-csrf-header-name"));
|
const get_csrf_header_name_1 = __importDefault(require("../../actions/get-csrf-header-name"));
|
||||||
const grab_host_names_1 = __importDefault(require("../../utils/grab-host-names"));
|
const grab_host_names_1 = __importDefault(require("../../utils/grab-host-names"));
|
||||||
const debug_log_1 = __importDefault(require("@/package-shared/utils/logging/debug-log"));
|
const debug_log_1 = __importDefault(require("../../utils/logging/debug-log"));
|
||||||
const minuteInMilliseconds = 60000;
|
const minuteInMilliseconds = 60000;
|
||||||
const hourInMilliseconds = minuteInMilliseconds * 60;
|
const hourInMilliseconds = minuteInMilliseconds * 60;
|
||||||
const dayInMilliseconds = hourInMilliseconds * 24;
|
const dayInMilliseconds = hourInMilliseconds * 24;
|
||||||
@ -122,21 +122,6 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
|
|||||||
if ((level === null || level === void 0 ? void 0 : level.match(/deep/i)) && finalRequest) {
|
if ((level === null || level === void 0 ? void 0 : level.match(/deep/i)) && finalRequest) {
|
||||||
const finalCsrfHeaderName = csrfHeaderName || (0, get_csrf_header_name_1.default)();
|
const finalCsrfHeaderName = csrfHeaderName || (0, get_csrf_header_name_1.default)();
|
||||||
if (finalRequest.headers[finalCsrfHeaderName] !== userObject.csrf_k) {
|
if (finalRequest.headers[finalCsrfHeaderName] !== userObject.csrf_k) {
|
||||||
(0, debug_log_1.default)({
|
|
||||||
log: finalCsrfHeaderName,
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:finalCsrfHeaderName",
|
|
||||||
});
|
|
||||||
(0, debug_log_1.default)({
|
|
||||||
log: finalRequest.headers[finalCsrfHeaderName],
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:finalRequest.headers[finalCsrfHeaderName]",
|
|
||||||
});
|
|
||||||
(0, debug_log_1.default)({
|
|
||||||
log: userObject,
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:userObject",
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: null,
|
payload: null,
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.default = getAuthCookieNames;
|
exports.default = getAuthCookieNames;
|
||||||
|
const get_csrf_header_name_1 = __importDefault(require("../../../actions/get-csrf-header-name"));
|
||||||
/**
|
/**
|
||||||
* # Grab Auth Cookie Names
|
* # Grab Auth Cookie Names
|
||||||
*/
|
*/
|
||||||
@ -8,7 +12,7 @@ function getAuthCookieNames(params) {
|
|||||||
var _a, _b;
|
var _a, _b;
|
||||||
const cookiesPrefix = process.env.DSQL_COOKIES_PREFIX || "dsql_";
|
const cookiesPrefix = process.env.DSQL_COOKIES_PREFIX || "dsql_";
|
||||||
const cookiesKeyName = process.env.DSQL_COOKIES_KEY_NAME || "key";
|
const cookiesKeyName = process.env.DSQL_COOKIES_KEY_NAME || "key";
|
||||||
const cookiesCSRFName = process.env.DSQL_COOKIES_CSRF_NAME || "csrf";
|
const cookiesCSRFName = (0, get_csrf_header_name_1.default)();
|
||||||
const cookieOneTimeCodeName = process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME || "one-time-code";
|
const cookieOneTimeCodeName = process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME || "one-time-code";
|
||||||
const targetDatabase = ((_a = params === null || params === void 0 ? void 0 : params.database) === null || _a === void 0 ? void 0 : _a.replace(/^datasquirel_user_\d+_/, "")) ||
|
const targetDatabase = ((_a = params === null || params === void 0 ? void 0 : params.database) === null || _a === void 0 ? void 0 : _a.replace(/^datasquirel_user_\d+_/, "")) ||
|
||||||
((_b = process.env.DSQL_DB_NAME) === null || _b === void 0 ? void 0 : _b.replace(/^datasquirel_user_\d+_/, ""));
|
((_b = process.env.DSQL_DB_NAME) === null || _b === void 0 ? void 0 : _b.replace(/^datasquirel_user_\d+_/, ""));
|
||||||
|
@ -6,7 +6,7 @@ import parseCookies from "../../utils/backend/parseCookies";
|
|||||||
import { AuthenticatedUser } from "../../types";
|
import { AuthenticatedUser } from "../../types";
|
||||||
import getCsrfHeaderName from "../../actions/get-csrf-header-name";
|
import getCsrfHeaderName from "../../actions/get-csrf-header-name";
|
||||||
import grabHostNames from "../../utils/grab-host-names";
|
import grabHostNames from "../../utils/grab-host-names";
|
||||||
import debugLog from "@/package-shared/utils/logging/debug-log";
|
import debugLog from "../../utils/logging/debug-log";
|
||||||
|
|
||||||
const minuteInMilliseconds = 60000;
|
const minuteInMilliseconds = 60000;
|
||||||
const hourInMilliseconds = minuteInMilliseconds * 60;
|
const hourInMilliseconds = minuteInMilliseconds * 60;
|
||||||
@ -166,22 +166,6 @@ export default function userAuth({
|
|||||||
if (
|
if (
|
||||||
finalRequest.headers[finalCsrfHeaderName] !== userObject.csrf_k
|
finalRequest.headers[finalCsrfHeaderName] !== userObject.csrf_k
|
||||||
) {
|
) {
|
||||||
debugLog({
|
|
||||||
log: finalCsrfHeaderName,
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:finalCsrfHeaderName",
|
|
||||||
});
|
|
||||||
debugLog({
|
|
||||||
log: finalRequest.headers[finalCsrfHeaderName],
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:finalRequest.headers[finalCsrfHeaderName]",
|
|
||||||
});
|
|
||||||
debugLog({
|
|
||||||
log: userObject,
|
|
||||||
addTime: true,
|
|
||||||
label: "userAuth:userObject",
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: null,
|
payload: null,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import getCsrfHeaderName from "../../../actions/get-csrf-header-name";
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
database?: string;
|
database?: string;
|
||||||
userId?: string | number;
|
userId?: string | number;
|
||||||
@ -15,7 +17,7 @@ type Return = {
|
|||||||
export default function getAuthCookieNames(params?: Param): Return {
|
export default function getAuthCookieNames(params?: Param): Return {
|
||||||
const cookiesPrefix = process.env.DSQL_COOKIES_PREFIX || "dsql_";
|
const cookiesPrefix = process.env.DSQL_COOKIES_PREFIX || "dsql_";
|
||||||
const cookiesKeyName = process.env.DSQL_COOKIES_KEY_NAME || "key";
|
const cookiesKeyName = process.env.DSQL_COOKIES_KEY_NAME || "key";
|
||||||
const cookiesCSRFName = process.env.DSQL_COOKIES_CSRF_NAME || "csrf";
|
const cookiesCSRFName = getCsrfHeaderName();
|
||||||
const cookieOneTimeCodeName =
|
const cookieOneTimeCodeName =
|
||||||
process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME || "one-time-code";
|
process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME || "one-time-code";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "4.5.1",
|
"version": "4.5.2",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user