connect-page: disable use real password button when there's no accounts

This commit is contained in:
Toast 2025-07-28 21:14:26 +02:00
parent 7c9c962b79
commit 161bbc7d26
2 changed files with 16 additions and 14 deletions

View file

@ -36,7 +36,7 @@
<span class="os lin mac"> <span class="os lin mac">
{% if accs %}<code><b id="pw0">{{ pw }}</b></code>=password, {% endif %}<code><b>mp</b></code>=mountpoint {% if accs %}<code><b id="pw0">{{ pw }}</b></code>=password, {% endif %}<code><b>mp</b></code>=mountpoint
</span> </span>
<a href="#" id="setpw">use real password</a> {% if accs %}<a href="#" id="setpw">use real password</a>{% endif %}
</p> </p>

View file

@ -49,19 +49,21 @@ function setos(os) {
setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk'); setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk');
ebi('setpw').onclick = function (e) { pwbutton = ebi('setpw')
ev(e); if (pwbutton != null)
modal.prompt('password:', '', function (v) { pwbutton.onclick = function (e) {
if (!v) ev(e);
return; modal.prompt('password:', '', function (v) {
if (!v)
return;
var pw0 = ebi('pw0').innerHTML, var pw0 = ebi('pw0').innerHTML,
oa = QSA('b'); oa = QSA('b');
for (var a = 0; a < oa.length; a++) for (var a = 0; a < oa.length; a++)
if (oa[a].innerHTML == pw0) if (oa[a].innerHTML == pw0)
oa[a].textContent = v; oa[a].textContent = v;
add_dls(); add_dls();
}); });
} }