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.

131 lines
4.6 KiB

  1. {% extends "base.html" %}
  2. {% load compress staticfiles %}
  3. {% block title %}Account Settings - healthchecks.io{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1 id="settings-title">Settings</h1>
  8. </div>
  9. {% if messages %}
  10. <div class="col-sm-12">
  11. {% for message in messages %}
  12. <p class="alert alert-success">{{ message }}</p>
  13. {% endfor %}
  14. </div>
  15. {% endif %}
  16. </div>
  17. <div class="row">
  18. <div class="col-sm-6">
  19. <div class="panel panel-default">
  20. <div class="panel-body settings-block">
  21. <form method="post">
  22. {% csrf_token %}
  23. <h2>Monthly Reports</h2>
  24. <label>
  25. <input
  26. name="reports_allowed"
  27. type="checkbox"
  28. {% if profile.reports_allowed %} checked {% endif %}>
  29. Each month send me a summary of my checks
  30. </label>
  31. <button
  32. name="update_reports_allowed"
  33. type="submit"
  34. class="btn btn-default pull-right">Save</button>
  35. </form>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="col-sm-6">
  40. <div class="panel panel-default">
  41. <div class="panel-body settings-block">
  42. <form method="post">
  43. {% csrf_token %}
  44. <h2>Set Password</h2>
  45. Attach a password to your healthchecks.io account
  46. <button
  47. type="submit"
  48. value="set_password"
  49. class="btn btn-default pull-right">Set Password</button>
  50. </form>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="col-sm-6">
  55. <div class="panel panel-default">
  56. <div class="panel-body settings-block">
  57. <h2>API Access</h2>
  58. {% if profile.api_key %}
  59. {% if show_api_key %}
  60. API key: <code>{{ profile.api_key }}</code>
  61. <button
  62. data-toggle="modal"
  63. data-target="#revoke-api-key-modal"
  64. class="btn btn-danger pull-right">Revoke</button>
  65. {% else %}
  66. <span class="text-success glyphicon glyphicon-ok"></span>
  67. API access is enabled.
  68. <form method="post">
  69. {% csrf_token %}
  70. <button
  71. type="submit"
  72. name="show_api_key"
  73. class="btn btn-default pull-right">Show API key</button>
  74. </form>
  75. {% endif %}
  76. {% else %}
  77. <span class="glyphicon glyphicon-remove"></span>
  78. API access is disabled.
  79. <form method="post">
  80. {% csrf_token %}
  81. <button
  82. type="submit"
  83. name="create_api_key"
  84. class="btn btn-default pull-right">Create API key</button>
  85. </form>
  86. {% endif %}
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div id="revoke-api-key-modal" class="modal">
  92. <div class="modal-dialog">
  93. <form id="revoke-api-key-form" method="post">
  94. {% csrf_token %}
  95. <div class="modal-content">
  96. <div class="modal-header">
  97. <button type="button" class="close" data-dismiss="modal">&times;</span></button>
  98. <h4 class="remove-check-title">Revoke API Key</h4>
  99. </div>
  100. <div class="modal-body">
  101. <p>You are about to revoke the current API key.</p>
  102. <p>Afterwards, you can create a new API key, but there will
  103. be <strong>no way of getting the current API
  104. key back</strong>.
  105. </p>
  106. <p>Are you sure?</p>
  107. </div>
  108. <div class="modal-footer">
  109. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  110. <button
  111. type="submit"
  112. name="revoke_api_key"
  113. class="btn btn-danger">Revoke API Key</button>
  114. </div>
  115. </div>
  116. </form>
  117. </div>
  118. </div>
  119. {% endblock %}