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 const resetUrl = authUrl
? `${authUrl}/reset-password/?code=${d.code}` ? `${authUrl}/reset-password/?code=${d.code}`
: `/reset-password/?code=${d.code}`; : `/reset-password/?code=${d.code}`;
btn.textContent = '🔗 Copy reset link'; // Show the URL inline so the admin can always see and copy it
btn.title = resetUrl; const cell = btn.closest('td')!;
btn.classList.add('text-yellow-300'); btn.remove();
btn.addEventListener('click', () => navigator.clipboard.writeText(resetUrl), { once: true }); 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 { } else {
btn.textContent = 'Error'; btn.textContent = 'Error';
btn.classList.add('text-red-400'); btn.classList.add('text-red-400');