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.

260 lines
9.7 KiB

9 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress static hc_extras %}
  3. {% block title %}Account Settings - {{ site_name }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1 class="settings-title">
  8. Settings
  9. <small>{{ request.user.email }}</small>
  10. </h1>
  11. </div>
  12. {% if messages %}
  13. <div class="col-sm-12">
  14. {% for message in messages %}
  15. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  16. {% endfor %}
  17. </div>
  18. {% endif %}
  19. </div>
  20. <div class="row">
  21. <div class="col-sm-3">
  22. <ul class="nav nav-pills nav-stacked">
  23. <li class="active"><a href="{% url 'hc-profile' %}">Account</a></li>
  24. {% if show_pricing %}
  25. <li><a href="{% url 'hc-billing' %}">Billing</a></li>
  26. {% endif %}
  27. <li><a href="{% url 'hc-notifications' %}">Email Reports</a></li>
  28. </ul>
  29. </div>
  30. <div class="col-sm-9 col-md-6">
  31. <div class="panel panel-{{ email_password_status|default:'default' }}">
  32. <div class="panel-body settings-block">
  33. <form method="post">
  34. {% csrf_token %}
  35. <h2>Email and Password</h2>
  36. <p>
  37. Your account's email address is
  38. <code>{{ request.user.email }}</code>
  39. <a
  40. href="{% url 'hc-change-email' %}"
  41. class="btn btn-default pull-right">Change Email</a>
  42. </p>
  43. <p class="clearfix"></p>
  44. <p>
  45. Attach a password to your {{ site_name }} account
  46. <a
  47. href="{% url 'hc-set-password' %}"
  48. class="btn btn-default pull-right">Set Password</a>
  49. </p>
  50. </form>
  51. </div>
  52. {% if changed_password %}
  53. <div class="panel-footer">
  54. Your new password has been set!
  55. </div>
  56. {% endif %}
  57. </div>
  58. {% if use_2fa %}
  59. <div class="panel panel-{{ 2fa_status }}">
  60. <div class="panel-body settings-block">
  61. <form method="post">
  62. {% csrf_token %}
  63. <h2>Two-factor Authentication</h2>
  64. {% if credentials %}
  65. <table id="my-keys" class="table">
  66. <tr>
  67. <th>Security keys</th>
  68. </tr>
  69. {% for credential in credentials %}
  70. <tr>
  71. <td>
  72. <strong>{{ credential.name|default:"unnamed" }}</strong>
  73. – registered on {{ credential.created|date:"M j, Y" }}
  74. </td>
  75. <td class="text-right">
  76. <a href="{% url 'hc-remove-credential' credential.code %}">Remove</a>
  77. </td>
  78. </tr>
  79. {% endfor %}
  80. </table>
  81. {% if credentials|length == 1 %}
  82. <p class="alert alert-info">
  83. <strong>Tip: add a second key!</strong>
  84. It is a good practice to register at least two security keys
  85. and store them separately.
  86. </p>
  87. {% endif %}
  88. {% else %}
  89. <p>
  90. Two-factor authentication is not enabled yet.<br />
  91. Your account has no registered security keys.
  92. </p>
  93. {% endif %}
  94. <a
  95. href="{% url 'hc-add-credential' %}"
  96. class="btn btn-default pull-right">
  97. Register New Security Key
  98. </a>
  99. </form>
  100. </div>
  101. {% if added_credential_name %}
  102. <div class="panel-footer">
  103. Added security key <strong>{{ added_credential_name }}</strong>.
  104. </div>
  105. {% endif %}
  106. {% if removed_credential_name %}
  107. <div class="panel-footer">
  108. Removed security key <strong>{{ removed_credential_name }}</strong>.
  109. </div>
  110. {% endif %}
  111. </div>
  112. {% endif %}
  113. <div class="panel panel-{{ my_projects_status }}">
  114. <div class="panel-body settings-block">
  115. {% csrf_token %}
  116. <h2>My Projects</h2>
  117. {% if profile.projects.exists %}
  118. <table id="my-projects" class="table">
  119. <tr>
  120. <th>Project</th>
  121. <th>My role</th>
  122. <th></th>
  123. </tr>
  124. {% for project in request.user.project_set.all %}
  125. <tr>
  126. <td>
  127. <div class="name">
  128. <a href="{% url 'hc-checks' project.code %}">
  129. {{ project }}
  130. </a>
  131. </div>
  132. </td>
  133. <td>Owner</td>
  134. <td>
  135. <a
  136. href="{% url 'hc-project-settings' project.code %}"
  137. class="pull-right">Settings</a>
  138. </td>
  139. </tr>
  140. {% endfor %}
  141. {% for m in request.user.memberships.all %}
  142. <tr>
  143. <td>
  144. <div class="name">
  145. <a href="{% url 'hc-checks' m.project.code %}">
  146. {{ m.project }}
  147. </a>
  148. </div>
  149. </td>
  150. <td>
  151. {% if m.rw %}
  152. Member
  153. {% else %}
  154. Read-only
  155. {% endif %}
  156. </td>
  157. <td>
  158. <a
  159. href="#"
  160. data-name="{{ m.project }}"
  161. data-code="{{ m.project.code }}"
  162. class="pull-right leave-project">Leave</a>
  163. </td>
  164. </tr>
  165. {% endfor %}
  166. </table>
  167. {% else %}
  168. <p>You do not have any projects. Create one!</p>
  169. {% endif %}
  170. <a
  171. id="create-project"
  172. href="#"
  173. class="btn btn-default pull-right"
  174. data-toggle="modal"
  175. data-target="#add-project-modal">Create a New Project</a>
  176. </div>
  177. {% if left_project %}
  178. <div class="panel-footer">
  179. Left project <strong>{{ left_project }}</strong>.
  180. </div>
  181. {% endif %}
  182. </div>
  183. <div class="panel panel-default">
  184. <div class="panel-body settings-block">
  185. {% csrf_token %}
  186. <h2>Close Account</h2>
  187. <p>This will permanently remove your {{ site_name }} account.</p>
  188. <div class="text-right">
  189. <a
  190. id="close-account"
  191. href="{% url 'hc-close' %}"
  192. class="btn btn-default">Close Account</a>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div id="leave-project-modal" class="modal">
  199. <div class="modal-dialog">
  200. <form id="leave-project-form" method="post">
  201. {% csrf_token %}
  202. <div class="modal-content">
  203. <div class="modal-header">
  204. <button type="button" class="close" data-dismiss="modal">&times;</button>
  205. <h4>Leave This Project?</h4>
  206. </div>
  207. <div class="modal-body">
  208. <p>
  209. You are about to leave the project <strong id="leave-project-name"></strong>.
  210. You will lose access to its checks and integrations.
  211. </p>
  212. <p>Are you sure?</p>
  213. <input
  214. type="hidden"
  215. name="code"
  216. id="leave-project-code" />
  217. </div>
  218. <div class="modal-footer">
  219. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  220. <button
  221. type="submit"
  222. name="leave_project"
  223. class="btn btn-danger">Leave Project</button>
  224. </div>
  225. </div>
  226. </form>
  227. </div>
  228. </div>
  229. {% include "accounts/add_project_modal.html" %}
  230. {% endblock %}
  231. {% block scripts %}
  232. {% compress js %}
  233. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  234. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  235. <script src="{% static 'js/add_project_modal.js' %}"></script>
  236. <script src="{% static 'js/profile.js' %}"></script>
  237. {% endcompress %}
  238. {% endblock %}