fix: show reset URL inline in admin table (was hidden in tooltip)
CI / Python tests (push) Waiting to run
CI / Frontend build (push) Waiting to run

This commit is contained in:
Davide Scaini
2026-06-03 12:05:10 +02:00
parent 7e8545f8db
commit e24d290127
+20 -4
View File
@@ -408,10 +408,26 @@ const authUrl = import.meta.env.PUBLIC_AUTH_URL ?? '';
const resetUrl = authUrl
? `${authUrl}/reset-password/?code=${d.code}`
: `/reset-password/?code=${d.code}`;
btn.textContent = '🔗 Copy reset link';
btn.title = resetUrl;
btn.classList.add('text-yellow-300');
btn.addEventListener('click', () => navigator.clipboard.writeText(resetUrl), { once: true });
// Show the URL inline so the admin can always see and copy it
const cell = btn.closest('td')!;
btn.remove();
cell.innerHTML = `
<div class="flex flex-col gap-1">
<input readonly value="${resetUrl}"
class="w-full px-2 py-1 rounded bg-zinc-800 border border-zinc-700 text-yellow-300 text-xs font-mono focus:outline-none focus:border-zinc-500 cursor-text"
onclick="this.select()" />
<button class="copy-url-btn text-xs px-2 py-1 rounded bg-zinc-700 hover:bg-zinc-600 text-zinc-300 transition-colors">Copy</button>
</div>`;
const input = cell.querySelector<HTMLInputElement>('input')!;
const copyBtn = cell.querySelector<HTMLButtonElement>('.copy-url-btn')!;
input.select();
navigator.clipboard.writeText(resetUrl).catch(() => {});
copyBtn.addEventListener('click', () => {
navigator.clipboard.writeText(resetUrl).catch(() => {});
input.select();
copyBtn.textContent = 'Copied!';
setTimeout(() => { copyBtn.textContent = 'Copy'; }, 2000);
});
} else {
btn.textContent = 'Error';
btn.classList.add('text-red-400');