only show jwt secret tip for admin users

This commit is contained in:
Josh Hawkins 2025-12-11 10:42:43 -06:00
parent 649ca49e55
commit e5fff32079
2 changed files with 26 additions and 14 deletions

View File

@ -769,7 +769,8 @@
"updatePassword": "Update Password for {{username}}",
"setPassword": "Set Password",
"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."
"multiDeviceWarning": "Any other devices where you are logged in will be required to re-login within {{refresh_time}}.",
"multiDeviceAdmin": "You can also force all users to re-authenticate immediately by rotating your JWT secret."
},
"changeRole": {
"title": "Change User Role",

View File

@ -26,6 +26,7 @@ import ActivityIndicator from "../indicators/activity-indicator";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useIsAdmin } from "@/hooks/use-is-admin";
type SetPasswordProps = {
show: boolean;
@ -46,6 +47,7 @@ export default function SetPasswordDialog({
}: SetPasswordProps) {
const { t } = useTranslation(["views/settings", "common"]);
const { getLocaleDocUrl } = useDocDomain();
const isAdmin = useIsAdmin();
const { data: config } = useSWR("config");
const refreshSeconds: number | undefined =
@ -233,19 +235,28 @@ export default function SetPasswordDialog({
ns: "views/settings",
})}
</p>
<p className="text-sm text-primary-variant">
<a
href={getLocaleDocUrl(
"configuration/authentication#jwt-token-secret",
)}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center text-primary"
>
{t("readTheDocumentation", { ns: "common" })}
<LuExternalLink className="ml-2 size-3" />
</a>
</p>
{isAdmin && (
<>
<p className="text-sm text-muted-foreground">
{t("users.dialog.passwordSetting.multiDeviceAdmin", {
ns: "views/settings",
})}
</p>
<p className="text-sm text-primary-variant">
<a
href={getLocaleDocUrl(
"configuration/authentication#jwt-token-secret",
)}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center text-primary"
>
{t("readTheDocumentation", { ns: "common" })}
<LuExternalLink className="ml-2 size-3" />
</a>
</p>
</>
)}
</DialogHeader>
<Form {...form}>