Skip to content

Commit df0a583

Browse files
fhirschmannclaude
andcommitted
feat: reveal toggle for the FTP password in settings
The FTP password is already persisted in NVS and sent back to the UI; add a show/hide (eye) toggle so the stored password can be viewed, and show an empty field instead of the literal "-1" default when none is set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c7ec1d0 commit df0a583

4 files changed

Lines changed: 42 additions & 8 deletions

File tree

html/locales/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@
371371
},
372372
"pwd": {
373373
"title": "FTP-Passwort",
374-
"placeholder": "Passwort"
374+
"placeholder": "Passwort",
375+
"show": "Passwort anzeigen/verbergen"
375376
},
376377
"start": {
377378
"title": "FTP-Server starten",

html/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@
372372
},
373373
"pwd": {
374374
"title": "FTP-password",
375-
"placeholder": "password"
375+
"placeholder": "password",
376+
"show": "Show/hide password"
376377
},
377378
"start": {
378379
"title": "Start FTP-server",

html/locales/fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@
364364
},
365365
"pwd": {
366366
"title": "Mot de passe FTP",
367-
"placeholder": "mot de passe"
367+
"placeholder": "mot de passe",
368+
"show": "Afficher/masquer le mot de passe"
368369
},
369370
"start": {
370371
"title": "Démarrer serveur FTP",

html/management.html

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,20 @@
845845
width: 60px;
846846
}
847847

848+
/* show/hide password reveal button (eye icon) inside an input-group */
849+
.cp-reveal-btn {
850+
border: 1px solid var(--cp-border);
851+
border-left: none;
852+
background: rgba(22, 33, 60, .2);
853+
color: var(--cp-cyan);
854+
}
855+
856+
.cp-reveal-btn:hover {
857+
color: #021019;
858+
background: var(--cp-cyan);
859+
border-color: var(--cp-cyan);
860+
}
861+
848862
#track {
849863
font-family: "Share Tech Mono", monospace;
850864
color: var(--cp-cyan);
@@ -2111,9 +2125,15 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
21112125
<label for="ftpUser" data-i18n="[prepend]ftp.user.title">:</label>
21122126
<input type="text" class="form-control" id="ftpUser" maxlength="0"
21132127
data-i18n="[placeholder]ftp.user.placeholder" name="ftpUser" value="" required>
2114-
<label for="pwd" data-i18n="[prepend]ftp.pwd.title">:</label>
2115-
<input type="password" class="form-control" id="ftpPwd" maxlength="0"
2116-
data-i18n="[placeholder]ftp.pwd.placeholder" name="ftpPwd" value="" required>
2128+
<label for="ftpPwd" data-i18n="[prepend]ftp.pwd.title">:</label>
2129+
<div class="input-group">
2130+
<input type="password" class="form-control" id="ftpPwd" maxlength="0"
2131+
data-i18n="[placeholder]ftp.pwd.placeholder" name="ftpPwd" value="" required>
2132+
<button class="btn cp-reveal-btn" type="button" id="ftpPwdToggle" tabindex="-1"
2133+
data-i18n="[title]ftp.pwd.show" onclick="togglePasswordField('ftpPwd', 'ftpPwdToggle')">
2134+
<i class="fas fa-eye"></i>
2135+
</button>
2136+
</div>
21172137
</div>
21182138
<div class="text-center">
21192139
<button type="reset" class="btn btn-warning" data-i18n="reset"></button>&nbsp;<button
@@ -3934,6 +3954,17 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
39343954
}
39353955
}
39363956

3957+
// Toggle a password input between hidden/visible and swap the eye icon.
3958+
function togglePasswordField(inputId, btnId) {
3959+
const input = document.getElementById(inputId);
3960+
if (!input) return;
3961+
const reveal = input.type === 'password';
3962+
input.type = reveal ? 'text' : 'password';
3963+
const btn = document.getElementById(btnId);
3964+
const ico = btn ? btn.querySelector('i') : null;
3965+
if (ico) ico.className = reveal ? 'fas fa-eye-slash' : 'fas fa-eye';
3966+
}
3967+
39373968
function updateOperationModeIndicator(opmode) {
39383969
const btStartSource = document.getElementById('btStartSource');
39393970
const btStartSink = document.getElementById('btStartSink');
@@ -4372,9 +4403,9 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
43724403
let ftpSettings = settings.ftp;
43734404
if (ftpSettings) {
43744405
document.getElementById('nav-ftp-tab').setAttribute('data-visible', true);
4375-
document.getElementById("ftpUser").value = ftpSettings.username;
4406+
document.getElementById("ftpUser").value = (ftpSettings.username === "-1") ? "" : ftpSettings.username;
43764407
document.getElementById("ftpUser").setAttribute('maxlength', ftpSettings.maxUserLength);
4377-
document.getElementById("ftpPwd").value = ftpSettings.password;
4408+
document.getElementById("ftpPwd").value = (ftpSettings.password === "-1") ? "" : ftpSettings.password;
43784409
document.getElementById("ftpPwd").setAttribute('maxlength', ftpSettings.maxPwdLength);
43794410
}
43804411
// mqtt

0 commit comments

Comments
 (0)