diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-15 16:28:21 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-15 16:28:21 +0200 |
| commit | 445362ed2f8591d54a3c34cb3c5a69049aefa8c6 (patch) | |
| tree | 064f2d2e936639fa6ca412ed662203b144172c3d /public | |
| parent | aa984c8c0cad4ac4bff74fc38f60c0e06af6fc50 (diff) | |
Style totp input fields so that they work better on mobile
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_interface.js | 9 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index b7cb1964..8fe105a7 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -90,6 +90,15 @@ $(document).ready(function () { | |||
| 90 | initialize_revision_diff_picker.initialize(); | 90 | initialize_revision_diff_picker.initialize(); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | if (document.querySelector('.otp_code')) { | ||
| 94 | document.querySelectorAll('.otp_code').forEach(function (field) { | ||
| 95 | field.addEventListener('input', function () { | ||
| 96 | var digits = field.value.replace(/\D/g, '').slice(0, 6); | ||
| 97 | if (field.value !== digits) { field.value = digits; } | ||
| 98 | }); | ||
| 99 | }); | ||
| 100 | } | ||
| 101 | |||
| 93 | var metadata_details = document.getElementById('metadata_details'); | 102 | var metadata_details = document.getElementById('metadata_details'); |
| 94 | if (metadata_details) { | 103 | if (metadata_details) { |
| 95 | var desktop_mq = window.matchMedia('(min-width: 1016px)'); | 104 | var desktop_mq = window.matchMedia('(min-width: 1016px)'); |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 9d96acd0..0dc1a048 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -2245,6 +2245,24 @@ form.otp_form input[type=text] { | |||
| 2245 | margin-bottom: 0.5rem; | 2245 | margin-bottom: 0.5rem; |
| 2246 | } | 2246 | } |
| 2247 | 2247 | ||
| 2248 | input[type=text].otp_code { | ||
| 2249 | font-family: monospace; | ||
| 2250 | font-weight: 800; | ||
| 2251 | font-variant-numeric: tabular-nums; | ||
| 2252 | font-size: 2rem; | ||
| 2253 | letter-spacing: 0.75em; | ||
| 2254 | text-align: left; | ||
| 2255 | |||
| 2256 | padding: 0.75rem 0 0.75rem 1.75rem; | ||
| 2257 | box-sizing: border-box; | ||
| 2258 | max-width: 18.5rem; | ||
| 2259 | background-color: var(--surface); | ||
| 2260 | background-image: repeating-linear-gradient(to right, var(--surface) 0 1ch, var(--surface-tint) 1ch calc(1ch + 0.75em)); | ||
| 2261 | background-repeat: no-repeat; | ||
| 2262 | background-position: 0.45rem; | ||
| 2263 | background-size: calc(6ch + 4.5em) calc(100% - 1.25rem); | ||
| 2264 | } | ||
| 2265 | |||
| 2248 | .otp_qr svg { | 2266 | .otp_qr svg { |
| 2249 | width: 220px; | 2267 | width: 220px; |
| 2250 | height: auto; | 2268 | height: auto; |
