2-step-verification-code.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ---
  2. title: 2-Step Verification Code
  3. layout: single
  4. ---
  5. <form
  6. class="card card-md"
  7. action="{{ base }}/"
  8. method="get"
  9. autocomplete="off"
  10. novalidate
  11. >
  12. <div class="card-body">
  13. <h2 class="card-title card-title-lg text-center mb-4">Authenticate Your Account</h2>
  14. <p class="my-4 text-center">Please confirm your account by entering the authorization code sent to <strong>+1 856-672-8552</strong>.</p>
  15. <div class="my-5">
  16. <div class="row g-4">
  17. {% for i in (1..2) %}
  18. <div class="col">
  19. <div class="row g-2">
  20. {% for i in (1..3) %}
  21. <div class="col">
  22. <input type="text" class="form-control form-control-lg text-center py-3" maxlength="1" inputmode="numeric" pattern="[0-9]*" data-code-input />
  23. </div>
  24. {% endfor %}
  25. </div>
  26. </div>
  27. {% endfor %}
  28. </div>
  29. </div>
  30. <div class="my-4">
  31. <label class="form-check">
  32. <input type="checkbox" class="form-check-input" />
  33. Dont't ask for codes again on this device
  34. </label>
  35. </div>
  36. <div class="form-footer">
  37. <div class="btn-list flex-nowrap">
  38. {% include "ui/button.html" text="Cancel" block=true href="2-step-verification.html" %}
  39. {% include "ui/button.html" text="Verify" block=true color="primary" %}
  40. </div>
  41. </div>
  42. </div>
  43. </form>
  44. <div class="text-center text-secondary mt-3">
  45. It may take a minute to receive your code. Haven't received it? <a href="{{ base }}/">Resend a new code.</a>
  46. </div>
  47. {% comment %}
  48. {% capture_global scripts %}
  49. <script>
  50. document.addEventListener("DOMContentLoaded", function() {
  51. var inputs = document.querySelectorAll('[data-code-input]');
  52. // Attach an event listener to each input element
  53. for(let i = 0; i < inputs.length; i++) {
  54. inputs[i].addEventListener('input', function(e) {
  55. // If the input field has a character, and there is a next input field, focus it
  56. if(e.target.value.length === e.target.maxLength && i + 1 < inputs.length) {
  57. inputs[i + 1].focus();
  58. }
  59. });
  60. inputs[i].addEventListener('keydown', function(e) {
  61. // If the input field is empty and the keyCode for Backspace (8) is detected, and there is a previous input field, focus it
  62. if(e.target.value.length === 0 && e.keyCode === 8 && i > 0) {
  63. inputs[i - 1].focus();
  64. }
  65. });
  66. }
  67. });
  68. </script>
  69. {% endcapture_global %}
  70. {% endcomment %}