You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.3 KiB

  1. {% extends "base.html" %}
  2. {% load compress static hc_extras %}
  3. {% block content %}
  4. <div class="row">
  5. <form
  6. id="login-tfa-form"
  7. class="col-sm-6 col-sm-offset-3"
  8. data-options="{{ options }}"
  9. method="post"
  10. encrypt="multipart/form-data">
  11. <h1>Two-factor Authentication</h1>
  12. <div id="pick-method">
  13. {% if totp_url %}
  14. <p>Please select how you want to authenticate.</p>
  15. {% else %}
  16. <p>
  17. Please authenticate using your security key.<br />
  18. When you are ready, press the button below.
  19. </p>
  20. {% endif %}
  21. <button
  22. id="use-key-btn"
  23. type="button"
  24. class="btn btn-primary">Use security key</button>
  25. {% if totp_url %}
  26. <a href="{{ totp_url }}" class="btn btn-default">
  27. Use authenticator app
  28. </a>
  29. {% endif %}
  30. </div>
  31. {% csrf_token %}
  32. <input id="credential_id" type="hidden" name="credential_id">
  33. <input id="authenticator_data" type="hidden" name="authenticator_data">
  34. <input id="client_data_json" type="hidden" name="client_data_json">
  35. <input id="signature" type="hidden" name="signature">
  36. <div id="waiting" class="hide">
  37. <h2>Waiting for security key</h2>
  38. <p>
  39. Follow your browser's steps to authenticate with your security key.
  40. </p>
  41. <div class="spinner started">
  42. <div class="d1"></div>
  43. <div class="d2"></div>
  44. <div class="d3"></div>
  45. </div>
  46. </div>
  47. <div id="error" class="alert alert-danger hide">
  48. <p>
  49. <strong>Something went wrong.</strong>
  50. </p>
  51. <p id="error-text"></p>
  52. <div class="text-right">
  53. <button id="retry" type="button" class="btn btn-danger">
  54. Try Again
  55. </button>
  56. </div>
  57. </div>
  58. <div id="success" class="hide">
  59. <div class="alert alert-success">
  60. <strong>Success!</strong>
  61. Credential acquired.
  62. </div>
  63. </div>
  64. </form>
  65. </div>
  66. {% endblock %}
  67. {% block scripts %}
  68. {% compress js %}
  69. <script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
  70. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  71. <script src="{% static 'js/cbor.js' %}"></script>
  72. <script src="{% static 'js/login_tfa.js' %}"></script>
  73. {% endcompress %}
  74. {% endblock %}