From 9d8982ae50362146abe96e1c69be26e0814eb425 Mon Sep 17 00:00:00 2001 From: M1 Date: Tue, 17 Mar 2026 06:29:58 +0400 Subject: [PATCH] fix: key rotation shows new key in dedicated reveal, not sub-key div; clarify account ID label --- apps/web/src/views/settings.ejs | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/apps/web/src/views/settings.ejs b/apps/web/src/views/settings.ejs index 62dc001..ab55314 100644 --- a/apps/web/src/views/settings.ejs +++ b/apps/web/src/views/settings.ejs @@ -15,11 +15,11 @@

Account

- +
- <%= it.account.id %> + <%= it.account.id %>
-

Your secret key was shown once at registration and cannot be displayed again. Use "Rotate Key" below to generate a new one.

+

Your login key was shown once at registration. Use "Rotate Key" below to replace it — the new key will be shown immediately.

@@ -47,6 +47,15 @@

Rotate Primary Key

Generates a new primary key. Your old key will stop working immediately. Sub-keys are not affected.

+ + + @@ -131,10 +140,17 @@ async function confirmReset() { if (!confirm('Rotate your primary key?\n\nYour current key will stop working immediately. Make sure to copy the new one.')) return; const data = await api('/account/reset-key', { method: 'POST', body: {} }); - // New key is shown once — display it in the new-key-reveal area - document.getElementById('new-key-value').textContent = data.key; - document.getElementById('new-key-reveal').classList.remove('hidden'); - // Cookie is set server-side by reset-key endpoint + document.getElementById('rotated-key-value').textContent = data.key; + document.getElementById('rotated-key-reveal').classList.remove('hidden'); + document.getElementById('rotated-key-reveal').scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + } + + function copyRotatedKey() { + const val = document.getElementById('rotated-key-value').textContent; + navigator.clipboard.writeText(val); + const btn = event.target; + btn.textContent = 'Copied!'; btn.classList.add('text-green-400'); + setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('text-green-400'); }, 1500); } function showCreateKey() {