|
202 | 202 |
|
203 | 203 | .input-group { |
204 | 204 | margin: 0; |
| 205 | + position: relative; |
| 206 | + } |
| 207 | + |
| 208 | + .password-toggle-icon { |
| 209 | + position: absolute; |
| 210 | + right: 1.05rem; |
| 211 | + top: 50%; |
| 212 | + transform: translateY(-50%); |
| 213 | + cursor: pointer; |
| 214 | + color: var(--text-muted); |
| 215 | + transition: color 0.2s ease; |
| 216 | + z-index: 10; |
| 217 | + } |
| 218 | + |
| 219 | + .password-toggle-icon:hover { |
| 220 | + color: var(--text-main); |
| 221 | + } |
| 222 | + |
| 223 | + .auth-input.password-input { |
| 224 | + padding-right: 2.75rem; |
205 | 225 | } |
206 | 226 |
|
207 | 227 | .auth-input { |
@@ -395,8 +415,10 @@ <h2 id="authTitle">Welcome Back</h2> |
395 | 415 | </div> |
396 | 416 |
|
397 | 417 | <div class="input-group"> |
398 | | - <input type="password" id="password" class="auth-input" placeholder="Password" value="demo123" |
399 | | - required autocomplete="current-password"> |
| 418 | + <input type="password" id="password" class="auth-input password-input" placeholder="Password" |
| 419 | + value="demo123" required autocomplete="current-password"> |
| 420 | + <i class="fa-solid fa-eye password-toggle-icon" id="togglePassword" title="Show Password" |
| 421 | + aria-label="Show password" role="button" tabindex="0"></i> |
400 | 422 | </div> |
401 | 423 |
|
402 | 424 | <!-- |
@@ -530,6 +552,35 @@ <h3 style="color: var(--text-main) !important;">Ambient Sanctuary</h3> |
530 | 552 | } |
531 | 553 | }); |
532 | 554 | } |
| 555 | + |
| 556 | + const togglePassword = document.getElementById('togglePassword'); |
| 557 | + if (togglePassword && passwordInput) { |
| 558 | + const toggleVisibility = () => { |
| 559 | + const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password'; |
| 560 | + passwordInput.setAttribute('type', type); |
| 561 | + |
| 562 | + if (type === 'password') { |
| 563 | + togglePassword.classList.remove('fa-eye-slash'); |
| 564 | + togglePassword.classList.add('fa-eye'); |
| 565 | + togglePassword.setAttribute('title', 'Show Password'); |
| 566 | + togglePassword.setAttribute('aria-label', 'Show password'); |
| 567 | + } else { |
| 568 | + togglePassword.classList.remove('fa-eye'); |
| 569 | + togglePassword.classList.add('fa-eye-slash'); |
| 570 | + togglePassword.setAttribute('title', 'Hide Password'); |
| 571 | + togglePassword.setAttribute('aria-label', 'Hide password'); |
| 572 | + } |
| 573 | + }; |
| 574 | + |
| 575 | + togglePassword.addEventListener('click', toggleVisibility); |
| 576 | + |
| 577 | + togglePassword.addEventListener('keydown', (e) => { |
| 578 | + if (e.key === 'Enter' || e.key === ' ') { |
| 579 | + e.preventDefault(); |
| 580 | + toggleVisibility(); |
| 581 | + } |
| 582 | + }); |
| 583 | + } |
533 | 584 | </script> |
534 | 585 | <script src="../js/pwa.js"></script> |
535 | 586 | <script> |
|
0 commit comments