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}}", "updatePassword": "Update Password for {{username}}",
"setPassword": "Set Password", "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." "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": { "changeRole": {
"title": "Change User Role", "title": "Change User Role",

View File

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