Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: missing auto-logout for inactive session timeout (#18176)

ecmadaodf7ed39d74f7
diff --git a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue
index a80d118af9..f0e6d12781 100644
--- a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue
+++ b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue
@@ -65,7 +65,7 @@
$t("settings.general.workspace.maximum-sql-result.rows.description")
}}
<span class="font-semibold! textinfolabel">
- {{ $t("settings.general.workspace.maximum-sql-result.rows.limit") }}
+ {{ $t("settings.general.workspace.no-limit") }}
</span>
</p>
<div class="mt-3 w-full flex flex-row justify-start items-center gap-4">
diff --git a/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue b/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue
index 9838ea5c7c..70ae299eb2 100644
--- a/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue
+++ b/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue
@@ -51,7 +51,7 @@
$t("settings.general.workspace.query-data-policy.timeout.description")
}}
<span class="font-semibold! textinfolabel">
- {{ $t("settings.general.workspace.maximum-sql-result.rows.limit") }}
+ {{ $t("settings.general.workspace.no-limit") }}
</span>
</p>
<div class="mt-3 w-full flex flex-row justify-start items-center gap-4">
diff --git a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
index ea35e7a566..db22f7e307 100644
--- a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
+++ b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
@@ -52,6 +52,9 @@
{{
$t("settings.general.workspace.inactive-session-timeout.description")
}}
+ <span class="font-semibold! textinfolabel">
+ {{ $t("settings.general.workspace.no-limit") }}
+ </span>
</p>
<NTooltip placement="top-start" :disabled="allowChangeSetting">
<template #trigger>
@@ -59,6 +62,7 @@
<NInputNumber
v-model:value="state.inactiveTimeout"
class="w-24 mr-4"
+ :min="-1"
:disabled="!allowChangeSetting"
/>
<span class="textinfo text-sm">
@@ -128,7 +132,7 @@ const getInitialState = (): LocalState => {
);
if (inactiveTimeoutSeconds) {
defaultState.inactiveTimeout =
- Math.floor(inactiveTimeoutSeconds / (60 * 60)) || 1;
+ Math.floor(inactiveTimeoutSeconds / (60 * 60)) || 0;
}
return defaultState;
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index cf1400fba6..b62d796183 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -641,10 +641,10 @@
"rows": {
"self": "Maximum SQL result rows",
"rows": "Rows",
- "description": "Limit the output rows in SQL query result.",
- "limit": "No limit when the value <= 0"
+ "description": "Limit the output rows in SQL query result."
}
},
+ "no-limit": "No limit when the value <= 0",
"query-data-policy": {
"timeout": {
"self": "Maximum query time",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index ac297e5f46..edef88f325 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -641,10 +641,10 @@
"rows": {
"self": "Máximo de filas de resultados de SQL",
"rows": "Filas",
- "description": "Limite las filas de salida en el resultado de la consulta SQL, el valor <= 0 significa que no hay límite.",
- "limit": "No hay límite cuando el valor <= 0"
+ "description": "Limite las filas de salida en el resultado de la consulta SQL, el valor <= 0 significa que no hay límite."
}
},
+ "no-limit": "No hay límite cuando el valor <= 0",
"query-data-policy": {
"timeout": {
"self": "Tiempo máximo de consulta",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 6fcef13cd2..5f105bd36a 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -641,10 +641,10 @@
"rows": {
"self": "最大SQL結果行数",
"rows": "行",
- "description": "SQL クエリ結果の出力行を制限します。値 <= 0 は制限がないことを意味します。",
- "limit": "値が0以下の場合、制限なし"
+ "description": "SQL クエリ結果の出力行を制限します。値 <= 0 は制限がないことを意味します。"
}
},
+ "no-limit": "値が0以下の場合、制限なし",
"query-data-policy": {
"timeout": {
"self": "最大クエリ時間",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 62449d90ea..f44f73c528 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -641,10 +641,10 @@
"rows": {
"self": "Số lượng hàng kết quả SQL tối đa",
"rows": "Hàng",
- "description": "Giới hạn số hàng đầu ra trong kết quả truy vấn SQL, giá trị <= 0 nghĩa là không giới hạn.",
- "limit": "Không giới hạn khi giá trị <= 0"
+ "description": "Giới hạn số hàng đầu ra trong kết quả truy vấn SQL, giá trị <= 0 nghĩa là không giới hạn."
}
},
+ "no-limit": "Không giới hạn khi giá trị <= 0",
"query-data-policy": {
"timeout": {
"self": "Thời gian truy vấn tối đa",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 8f4dcf04d8..2589bb1bce 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -641,10 +641,10 @@
"rows": {
"self": "SQL结果行数上限",
"rows": "行",
- "description": "限制SQL查询结果的输出行数,值 <=0 表示不限制。",
- "limit": "当值 <= 0 时无限制"
+ "description": "限制SQL查询结果的输出行数,值 <=0 表示不限制。"
}
},
+ "no-limit": "当值 <= 0 时无限制",
"query-data-policy": {
"timeout": {
"self": "最大查询时间",
diff --git a/frontend/src/views/auth/InactiveRemindModal.vue b/frontend/src/views/auth/InactiveRemindModal.vue
index c0d100956b..56776810cc 100644
--- a/frontend/src/views/auth/InactiveRemindModal.vue
+++ b/frontend/src/views/auth/InactiveRemindModal.vue
@@ -35,7 +35,7 @@
<script lang="tsx" setup>
import { NButton } from "naive-ui";
-import { computed } from "vue";
+import { computed, onUnmounted, ref, watch } from "vue";
import { BBModal } from "@/bbkit";
import { useCurrentTimestamp } from "@/composables/useCurrentTimestamp";
import { useLastActivity } from "@/composables/useLastActivity";
@@ -43,6 +43,7 @@ import { useAuthStore, useSettingV1Store } from "@/store";
const authStore = useAuthStore();
const settingStore = useSettingV1Store();
+const timer = ref<NodeJS.Timeout | undefined>();
// Show the modal 3min before the inactiveTimeout threshold.
const showModalThresholdInMins = 3;
@@ -75,4 +76,31 @@ const shouldShow = computed(() => {
inactiveTimeoutInSeconds.value - showModalThresholdInMins * 60
);
});
+
+const resetTimeout = () => {
+ if (timer.value) {
+ clearTimeout(timer.value);
+ timer.value = undefined;
+ }
+};
+
+watch(
+ () => shouldShow.value,
+ (show) => {
+ resetTimeout();
+
+ if (show) {
+ timer.value = setTimeout(
+ () => {
+ logout();
+ },
+ showModalThresholdInMins * 60 * 1000
+ );
+ }
+ }
+);
+
+onUnmounted(() => {
+ resetTimeout();
+});
</script>