|
845 | 845 | width: 60px; |
846 | 846 | } |
847 | 847 |
|
| 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 | + |
848 | 862 | #track { |
849 | 863 | font-family: "Share Tech Mono", monospace; |
850 | 864 | color: var(--cp-cyan); |
@@ -2111,9 +2125,15 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
2111 | 2125 | <label for="ftpUser" data-i18n="[prepend]ftp.user.title">:</label> |
2112 | 2126 | <input type="text" class="form-control" id="ftpUser" maxlength="0" |
2113 | 2127 | 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> |
2117 | 2137 | </div> |
2118 | 2138 | <div class="text-center"> |
2119 | 2139 | <button type="reset" class="btn btn-warning" data-i18n="reset"></button> <button |
@@ -3934,6 +3954,17 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
3934 | 3954 | } |
3935 | 3955 | } |
3936 | 3956 |
|
| 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 | + |
3937 | 3968 | function updateOperationModeIndicator(opmode) { |
3938 | 3969 | const btStartSource = document.getElementById('btStartSource'); |
3939 | 3970 | const btStartSink = document.getElementById('btStartSink'); |
@@ -4372,9 +4403,9 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
4372 | 4403 | let ftpSettings = settings.ftp; |
4373 | 4404 | if (ftpSettings) { |
4374 | 4405 | 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; |
4376 | 4407 | document.getElementById("ftpUser").setAttribute('maxlength', ftpSettings.maxUserLength); |
4377 | | - document.getElementById("ftpPwd").value = ftpSettings.password; |
| 4408 | + document.getElementById("ftpPwd").value = (ftpSettings.password === "-1") ? "" : ftpSettings.password; |
4378 | 4409 | document.getElementById("ftpPwd").setAttribute('maxlength', ftpSettings.maxPwdLength); |
4379 | 4410 | } |
4380 | 4411 | // mqtt |
|
0 commit comments