Skip to content

Commit 025942a

Browse files
authored
connect: hide "use real pw" when no accs (#242)
Disable the "use the real password" button on the connect page when there's no accounts
2 parents 7c9c962 + 510100c commit 025942a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

copyparty/web/svcs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<span class="os lin mac">
3737
{% if accs %}<code><b id="pw0">{{ pw }}</b></code>=password, {% endif %}<code><b>mp</b></code>=mountpoint
3838
</span>
39-
<a href="#" id="setpw">use real password</a>
39+
{% if accs %}<a href="#" id="setpw">use real password</a>{% endif %}
4040
</p>
4141

4242

copyparty/web/svcs.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,21 @@ function setos(os) {
4949
setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk');
5050

5151

52-
ebi('setpw').onclick = function (e) {
52+
function setpw() {
5353
ev(e);
5454
modal.prompt('password:', '', function (v) {
5555
if (!v)
5656
return;
5757

5858
var pw0 = ebi('pw0').innerHTML,
5959
oa = QSA('b');
60-
60+
6161
for (var a = 0; a < oa.length; a++)
6262
if (oa[a].innerHTML == pw0)
6363
oa[a].textContent = v;
6464

6565
add_dls();
6666
});
6767
}
68+
if (ebi('setpw'))
69+
ebi('setpw').onclick = setpw;

0 commit comments

Comments
 (0)