From 7bbf287698dc5bc9f7863d5375ca27f61a59c868 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 8 Dec 2025 09:23:47 -0600 Subject: [PATCH] add multi device warning to password dialog --- web/public/locales/en/views/settings.json | 3 +- .../components/overlay/SetPasswordDialog.tsx | 35 +++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 0621e7c93..cc3a1b727 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -768,7 +768,8 @@ "passwordVerificationFailed": "Failed to verify password", "updatePassword": "Update Password for {{username}}", "setPassword": "Set Password", - "desc": "Create a strong password to secure this account." + "desc": "Create a strong password to secure this account.", + "multiDeviceWarning": "Any other devices where you are logged in will be required to re-login within {{refresh_time}}. You can also force all users to re-authenticate immediately by rotating your JWT secret." }, "changeRole": { "title": "Change User Role", diff --git a/web/src/components/overlay/SetPasswordDialog.tsx b/web/src/components/overlay/SetPasswordDialog.tsx index b8a3b9d86..cceef91f0 100644 --- a/web/src/components/overlay/SetPasswordDialog.tsx +++ b/web/src/components/overlay/SetPasswordDialog.tsx @@ -11,8 +11,11 @@ import { } from "../ui/dialog"; import { Label } from "../ui/label"; -import { LuCheck, LuX, LuEye, LuEyeOff } from "react-icons/lu"; +import { LuCheck, LuX, LuEye, LuEyeOff, LuExternalLink } from "react-icons/lu"; import { useTranslation } from "react-i18next"; +import { useDocDomain } from "@/hooks/use-doc-domain"; +import useSWR from "swr"; +import { formatSecondsToDuration } from "@/utils/dateUtil"; import ActivityIndicator from "../indicators/activity-indicator"; type SetPasswordProps = { @@ -32,7 +35,15 @@ export default function SetPasswordDialog({ initialError, username, }: SetPasswordProps) { - const { t } = useTranslation(["views/settings"]); + const { t } = useTranslation(["views/settings", "common"]); + const { getLocaleDocUrl } = useDocDomain(); + + const { data: config } = useSWR("config"); + const refreshSeconds: number | undefined = + config?.auth?.refresh_time ?? undefined; + const refreshTimeLabel = refreshSeconds + ? formatSecondsToDuration(refreshSeconds) + : "30 minutes"; const [oldPassword, setOldPassword] = useState(""); const [password, setPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState(""); @@ -177,6 +188,26 @@ export default function SetPasswordDialog({ {t("users.dialog.passwordSetting.desc")} + +

+ {t("users.dialog.passwordSetting.multiDeviceWarning", { + refresh_time: refreshTimeLabel, + ns: "views/settings", + })} +

+

+ + {t("readTheDocumentation", { ns: "common" })} + + +