|
4 | 4 | {% block title %}Sign into Kiwix Admin{% endblock %} |
5 | 5 |
|
6 | 6 | {% block head %} |
7 | | -<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"> |
8 | 7 | <style type="text/css"> |
9 | 8 | main header { |
10 | 9 | margin-bottom: .5em; |
|
57 | 56 | --bs-link-hover-color-rgb: 227,130,14; |
58 | 57 | text-decoration: none; |
59 | 58 | } |
| 59 | + |
| 60 | + #toggle-password { |
| 61 | + border: none; |
| 62 | + background: transparent; |
| 63 | + } |
| 64 | + |
| 65 | + .items-center { |
| 66 | + display: flex; |
| 67 | + align-items: center; |
| 68 | + } |
60 | 69 | </style> |
61 | 70 | {% endblock %} |
62 | 71 |
|
|
72 | 81 | <label class="form-label" for="username">Username</label> |
73 | 82 | <input type="text" class="form-control{% if is_incorrect %} is-invalid{% endif %}" name="username" placeholder="Usually “admin”" /> |
74 | 83 | </div> |
75 | | - <div class="mb-3"> |
| 84 | + <div class="mb-3 items-center"> |
76 | 85 | <label class="form-label" for="password">Password</label> |
77 | 86 | <input type="password" id="password-input" class="form-control{% if is_incorrect %} is-invalid{% endif %}" name="password" aria-describedby="credentialsFeedback"> |
78 | 87 |
|
79 | 88 | <button class="btn btn-outline-secondary" type="button" id="toggle-password"> |
80 | | - <i class="fa-solid fa-eye"></i> |
| 89 | + <svg id="eye-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> |
| 90 | + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> |
| 91 | + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/> |
| 92 | + </svg> |
| 93 | + <svg id="eye-slash-icon" style="display: none;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> |
| 94 | + <path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/> |
| 95 | + <path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/> |
| 96 | + <path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z"/> |
| 97 | + </svg> |
81 | 98 | </button> |
82 | | - |
83 | 99 | {% if is_incorrect and message_content %}<div id="credentialsFeedback" class="invalid-feedback">{{ message_content }}</div>{% endif %} |
84 | 100 | </div> |
85 | 101 | <div class="d-flex flex-row-reverse"> |
|
90 | 106 | <div class="mt-1 mb-1 p-3"><a class="returnlink" href="http://{{ ctx.fqdn }}"><i class="fa-solid fa-arrow-left"></i> Return to the Hotspot</a></div> |
91 | 107 |
|
92 | 108 | <script> |
93 | | - const togglePassword = document.querySelector('#toggle-password'); |
| 109 | + const toggleButton = document.querySelector('#toggle-password'); |
94 | 110 | const password = document.querySelector('#password-input'); |
| 111 | + const eyeIcon = document.querySelector('#eye-icon'); |
| 112 | + const eyeSlashIcon = document.querySelector('#eye-slash-icon'); |
95 | 113 |
|
96 | | - togglePassword.addEventListener('click', function (e) { |
97 | | - // toggle the type attribute |
| 114 | + toggleButton.addEventListener('click', function (e) { |
| 115 | + // Toggle the password visibility |
98 | 116 | const type = password.getAttribute('type') === 'password' ? 'text' : 'password'; |
99 | 117 | password.setAttribute('type', type); |
100 | 118 |
|
101 | | - // toggle the eye icon |
102 | | - const icon = this.querySelector('i'); |
103 | | - icon.classList.toggle('fa-eye'); |
104 | | - icon.classList.toggle('fa-eye-slash'); |
| 119 | + // Toggle the SVG icons |
| 120 | + if (type === 'text') { |
| 121 | + eyeIcon.style.display = 'none'; |
| 122 | + eyeSlashIcon.style.display = 'block'; |
| 123 | + } else { |
| 124 | + eyeIcon.style.display = 'block'; |
| 125 | + eyeSlashIcon.style.display = 'none'; |
| 126 | + } |
105 | 127 | }); |
106 | 128 | </script> |
107 | 129 | {% endblock %} |
0 commit comments