fix(downloads): confirm before clearing a link password; fix placeholder
Review follow-up on the share-link password UI: - Removing a link's password makes it publicly watchable, a protection downgrade; gate it behind a danger-confirm like the neighbouring Revoke, spelling out that anyone with the URL can then watch without a password. - When setting a first password the input reused the create-form "Password (optional)" placeholder, but it's required here (Save stays disabled until non-empty); use the "Set a password" wording instead.
This commit is contained in:
@@ -205,7 +205,7 @@ function LinkRow({ link, onChanged }: { link: ShareLink; onChanged: () => void }
|
||||
e.key === "Enter" && newPass.trim() && savePass.mutate(newPass.trim())
|
||||
}
|
||||
placeholder={t(
|
||||
link.has_password ? "downloads.share.newPassword" : "downloads.share.password",
|
||||
link.has_password ? "downloads.share.newPassword" : "downloads.share.setPassword",
|
||||
)}
|
||||
className="flex-1 min-w-0 bg-card border border-border rounded-md px-2 py-1 text-xs outline-none focus:border-accent"
|
||||
/>
|
||||
@@ -218,7 +218,17 @@ function LinkRow({ link, onChanged }: { link: ShareLink; onChanged: () => void }
|
||||
</button>
|
||||
{link.has_password && (
|
||||
<button
|
||||
onClick={() => savePass.mutate("")}
|
||||
onClick={async () => {
|
||||
if (
|
||||
await confirm({
|
||||
title: t("downloads.share.removePassword"),
|
||||
message: t("downloads.share.removePasswordConfirm"),
|
||||
confirmLabel: t("downloads.share.removePassword"),
|
||||
danger: true,
|
||||
})
|
||||
)
|
||||
savePass.mutate("");
|
||||
}}
|
||||
disabled={savePass.isPending}
|
||||
className="px-2 py-1 rounded-md text-xs text-muted hover:text-red-400 transition"
|
||||
>
|
||||
|
||||
@@ -123,7 +123,8 @@
|
||||
"changePassword": "Change password",
|
||||
"newPassword": "New password",
|
||||
"savePassword": "Save",
|
||||
"removePassword": "Remove"
|
||||
"removePassword": "Remove",
|
||||
"removePasswordConfirm": "This makes the link public — anyone with the URL can watch it without a password."
|
||||
},
|
||||
"confirm": {
|
||||
"cancelTitle": "Cancel download?",
|
||||
|
||||
@@ -123,7 +123,8 @@
|
||||
"changePassword": "Jelszó módosítása",
|
||||
"newPassword": "Új jelszó",
|
||||
"savePassword": "Mentés",
|
||||
"removePassword": "Törlés"
|
||||
"removePassword": "Törlés",
|
||||
"removePasswordConfirm": "Ezzel a link publikus lesz — jelszó nélkül bárki megnézheti, akinek megvan az URL."
|
||||
},
|
||||
"confirm": {
|
||||
"cancelTitle": "Megszakítod a letöltést?",
|
||||
|
||||
Reference in New Issue
Block a user