refac: disable jwt display for non-admin users

This commit is contained in:
Timothy Jaeryang Baek 2025-04-28 17:45:17 +04:00
parent 791c19acf7
commit ee8de1ee0b

View File

@ -87,7 +87,7 @@
</script> </script>
<div class="flex flex-col h-full justify-between text-sm"> <div class="flex flex-col h-full justify-between text-sm">
<div class=" space-y-3 overflow-y-scroll max-h-[28rem] lg:max-h-full"> <div class=" overflow-y-scroll max-h-[28rem] lg:max-h-full">
<input <input
id="profile-image-input" id="profile-image-input"
bind:this={profileImageInputElement} bind:this={profileImageInputElement}
@ -236,7 +236,7 @@
<div class="flex-1"> <div class="flex-1">
<input <input
class="w-full text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden" class="w-full text-sm dark:text-gray-300 bg-transparent outline-hidden"
type="text" type="text"
bind:value={name} bind:value={name}
required required
@ -265,12 +265,13 @@
{/if} {/if}
</div> </div>
<div class="py-0.5"> <hr class="border-gray-50 dark:border-gray-850 my-2" />
<div class="my-2">
<UpdatePassword /> <UpdatePassword />
</div> </div>
<hr class="border-gray-50 dark:border-gray-850 my-2" /> {#if ($config?.features?.enable_api_key ?? true) || $user?.role === 'admin'}
<div class="flex justify-between items-center text-sm"> <div class="flex justify-between items-center text-sm">
<div class=" font-medium">{$i18n.t('API keys')}</div> <div class=" font-medium">{$i18n.t('API keys')}</div>
<button <button
@ -284,6 +285,7 @@
{#if showAPIKeys} {#if showAPIKeys}
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{#if $user?.role === 'admin'}
<div class="justify-between w-full"> <div class="justify-between w-full">
<div class="flex justify-between w-full"> <div class="flex justify-between w-full">
<div class="self-center text-xs font-medium">{$i18n.t('JWT Token')}</div> <div class="self-center text-xs font-medium">{$i18n.t('JWT Token')}</div>
@ -337,11 +339,15 @@
</button> </button>
</div> </div>
</div> </div>
{/if}
{#if $config?.features?.enable_api_key ?? true} {#if $config?.features?.enable_api_key ?? true}
<div class="justify-between w-full"> <div class="justify-between w-full">
{#if $user?.role === 'admin'}
<div class="flex justify-between w-full"> <div class="flex justify-between w-full">
<div class="self-center text-xs font-medium">{$i18n.t('API Key')}</div> <div class="self-center text-xs font-medium">{$i18n.t('API Key')}</div>
</div> </div>
{/if}
<div class="flex mt-2"> <div class="flex mt-2">
{#if APIKey} {#if APIKey}
<SensitiveInput value={APIKey} readOnly={true} /> <SensitiveInput value={APIKey} readOnly={true} />
@ -430,6 +436,7 @@
{/if} {/if}
</div> </div>
{/if} {/if}
{/if}
</div> </div>
<div class="flex justify-end pt-3 text-sm font-medium"> <div class="flex justify-end pt-3 text-sm font-medium">