Remove copy buttons from credentials panels
This commit is contained in:
+4
-23
@@ -2516,10 +2516,10 @@ def session_view_page(session_id: str, request: Request, user: User = Depends(re
|
|||||||
rows = ""
|
rows = ""
|
||||||
if service.svc_login:
|
if service.svc_login:
|
||||||
login_esc = service.svc_login.replace('"', '"').replace('<', '<')
|
login_esc = service.svc_login.replace('"', '"').replace('<', '<')
|
||||||
rows += f'''<div class="cr-row"><span class="cr-label">Логин</span><span class="cr-val">{login_esc}</span><button class="cr-copy" data-copy="{login_esc}" title="Копировать">⎘</button></div>'''
|
rows += f'''<div class="cr-row"><span class="cr-label">Логин</span><span class="cr-val">{login_esc}</span></div>'''
|
||||||
if service.svc_password:
|
if service.svc_password:
|
||||||
pass_esc = service.svc_password.replace('"', '"').replace('<', '<')
|
pass_esc = service.svc_password.replace('"', '"').replace('<', '<')
|
||||||
rows += f'''<div class="cr-row"><span class="cr-label">Пароль</span><span class="cr-val cr-masked">{pass_esc}</span><button class="cr-copy" data-copy="{pass_esc}" title="Копировать">⎘</button></div>'''
|
rows += f'''<div class="cr-row"><span class="cr-label">Пароль</span><span class="cr-val cr-masked">{pass_esc}</span></div>'''
|
||||||
if service.svc_cred_hint:
|
if service.svc_cred_hint:
|
||||||
hint_esc = service.svc_cred_hint.replace('<', '<')
|
hint_esc = service.svc_cred_hint.replace('<', '<')
|
||||||
rows += f'''<p class="cr-hint">{hint_esc}</p>'''
|
rows += f'''<p class="cr-hint">{hint_esc}</p>'''
|
||||||
@@ -2532,19 +2532,7 @@ def session_view_page(session_id: str, request: Request, user: User = Depends(re
|
|||||||
document.getElementById("creds-close").onclick = function() {{
|
document.getElementById("creds-close").onclick = function() {{
|
||||||
document.getElementById("creds-panel").style.display = "none";
|
document.getElementById("creds-panel").style.display = "none";
|
||||||
}};
|
}};
|
||||||
document.querySelectorAll(".cr-copy").forEach(function(btn) {{
|
|
||||||
btn.addEventListener("click", async function() {{
|
|
||||||
var text = btn.dataset.copy;
|
|
||||||
try {{ await navigator.clipboard.writeText(text); }} catch(e) {{
|
|
||||||
var 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(function() {{ btn.classList.remove("copied"); }}, 1500);
|
|
||||||
}});
|
|
||||||
}});
|
|
||||||
</script>'''
|
</script>'''
|
||||||
|
|
||||||
return HTMLResponse(
|
return HTMLResponse(
|
||||||
@@ -2574,14 +2562,7 @@ def session_view_page(session_id: str, request: Request, user: User = Depends(re
|
|||||||
.cr-val{{font:600 13px/1 monospace;color:#dce8f5;flex:1;overflow:hidden;
|
.cr-val{{font:600 13px/1 monospace;color:#dce8f5;flex:1;overflow:hidden;
|
||||||
text-overflow:ellipsis;white-space:nowrap;}}
|
text-overflow:ellipsis;white-space:nowrap;}}
|
||||||
.cr-masked{{letter-spacing:.1em;font-size:14px;}}
|
.cr-masked{{letter-spacing:.1em;font-size:14px;}}
|
||||||
.cr-copy{{
|
|
||||||
flex-shrink:0;width:26px;height:26px;border:1px solid rgba(255,255,255,.26);
|
|
||||||
border-radius:6px;background:linear-gradient(180deg,#2a8cd6,#1668a6);
|
|
||||||
color:#fff;cursor:pointer;font-size:13px;display:grid;place-items:center;padding:0;
|
|
||||||
box-shadow:inset 0 1px 0 rgba(255,255,255,.22);transition:filter .15s;
|
|
||||||
}}
|
|
||||||
.cr-copy:hover{{filter:brightness(1.15)}}
|
|
||||||
.cr-copy.copied{{background:linear-gradient(180deg,#2ab86a,#1a8a4a);}}
|
|
||||||
.cr-hint{{margin:4px 0 0;font:400 11px/1.35 sans-serif;color:rgba(180,210,240,.65);}}
|
.cr-hint{{margin:4px 0 0;font:400 11px/1.35 sans-serif;color:rgba(180,210,240,.65);}}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user