Add credentials panel on view page; remove copy buttons from dashboard cards

This commit is contained in:
2026-04-28 13:47:46 +00:00
parent 4cc19b32d8
commit beb6828520
3 changed files with 64 additions and 39 deletions
-18
View File
@@ -91,14 +91,12 @@
<div class="svc-cred-row">
<span class="svc-cred-label">Логин</span>
<span class="svc-cred-value">{{ service.svc_login }}</span>
<button class="svc-cred-copy" type="button" data-copy="{{ service.svc_login }}" title="Копировать логин"></button>
</div>
{% endif %}
{% if service.svc_password %}
<div class="svc-cred-row">
<span class="svc-cred-label">Пароль</span>
<span class="svc-cred-value svc-cred-masked">{{ service.svc_password }}</span>
<button class="svc-cred-copy" type="button" data-copy="{{ service.svc_password }}" title="Копировать пароль"></button>
</div>
{% endif %}
{% if service.svc_cred_hint %}
@@ -219,21 +217,5 @@
});
})();
</script>
<script>
document.querySelectorAll('.svc-cred-copy').forEach(btn => {
btn.addEventListener('click', async (e) => {
e.preventDefault(); e.stopPropagation();
const text = btn.dataset.copy;
try { await navigator.clipboard.writeText(text); } catch(_) {
const ta = document.createElement('textarea');
ta.value = text; ta.style.position='fixed'; ta.style.opacity='0';
document.body.appendChild(ta); ta.select();
document.execCommand('copy'); document.body.removeChild(ta);
}
btn.classList.add('copied');
setTimeout(() => btn.classList.remove('copied'), 1500);
});
});
</script>
</body>
</html>