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.

322 lines
12 KiB

8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress staticfiles 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">Settings</h1>
  8. </div>
  9. {% if messages %}
  10. <div class="col-sm-12">
  11. {% for message in messages %}
  12. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  13. {% endfor %}
  14. </div>
  15. {% endif %}
  16. </div>
  17. <div class="row">
  18. <div class="col-sm-3">
  19. <ul class="nav nav-pills nav-stacked">
  20. <li class="active"><a href="{% url 'hc-profile' %}">Account</a></li>
  21. <li><a href="{% url 'hc-notifications' %}">Notifications</a></li>
  22. <li><a href="{% url 'hc-badges' %}">Badges</a></li>
  23. </ul>
  24. </div>
  25. <div class="col-sm-9 col-md-6">
  26. <div class="panel panel-default">
  27. <div class="panel-body settings-block">
  28. <form method="post">
  29. {% csrf_token %}
  30. <h2>Set Password</h2>
  31. Attach a password to your {% site_name %} account
  32. <button
  33. type="submit"
  34. name="set_password"
  35. class="btn btn-default pull-right">Set Password</button>
  36. </form>
  37. </div>
  38. </div>
  39. <div class="panel panel-default">
  40. <div class="panel-body settings-block">
  41. <h2>API Access</h2>
  42. {% if profile.api_key %}
  43. {% if show_api_key %}
  44. API key: <code>{{ profile.api_key }}</code>
  45. <button
  46. data-toggle="modal"
  47. data-target="#revoke-api-key-modal"
  48. class="btn btn-danger pull-right">Revoke</button>
  49. {% else %}
  50. <form method="post">
  51. <span class="icon-ok"></span>
  52. API access is enabled.
  53. {% csrf_token %}
  54. <button
  55. type="submit"
  56. name="show_api_key"
  57. class="btn btn-default pull-right">Show API key</button>
  58. </form>
  59. {% endif %}
  60. {% else %}
  61. <span class="icon-cancel"></span>
  62. API access is disabled.
  63. <form method="post">
  64. {% csrf_token %}
  65. <button
  66. type="submit"
  67. name="create_api_key"
  68. class="btn btn-default pull-right">Create API key</button>
  69. </form>
  70. {% endif %}
  71. </div>
  72. </div>
  73. <div class="panel panel-default">
  74. <div class="panel-body settings-block">
  75. <h2>Team Access</h2>
  76. {% if profile.member_set.count %}
  77. <table class="table">
  78. <tr>
  79. <td>{{ profile.user.email }}</td>
  80. <td>Owner</td>
  81. <td></td>
  82. </tr>
  83. {% for member in profile.member_set.all %}
  84. <tr>
  85. <td>{{ member.user.email }} </td>
  86. <td>Member</td>
  87. <td>
  88. <a
  89. href="#"
  90. data-email="{{ member.user.email }}"
  91. class="pull-right member-remove">Remove</a>
  92. </td>
  93. </tr>
  94. {% endfor %}
  95. </table>
  96. {% else %}
  97. <p>
  98. <strong>Invite team members to your account.</strong>
  99. </p>
  100. <p>
  101. Share access to your checks and configured integrations
  102. without having to share a login.
  103. </p>
  104. {% if not profile.team_access_allowed %}
  105. <p>
  106. To enable team access, please upgrade to
  107. one of the <a href="{% url 'hc-pricing' %}">paid plans</a>.
  108. </p>
  109. {% endif %}
  110. {% endif %}
  111. <br />
  112. {% if profile.team_access_allowed %}
  113. <a
  114. href="#"
  115. class="btn btn-default"
  116. data-toggle="modal"
  117. data-target="#set-team-name-modal">Set Team Name</a>
  118. <a
  119. href="#"
  120. class="btn btn-primary pull-right"
  121. data-toggle="modal"
  122. data-target="#invite-team-member-modal">Invite a Team Member</a>
  123. {% endif %}
  124. </div>
  125. </div>
  126. <div class="panel panel-default">
  127. <div class="panel-body settings-block">
  128. {% csrf_token %}
  129. <h2>Close Account</h2>
  130. <a
  131. id="close-account"
  132. href="#"
  133. class="btn btn-default pull-right"
  134. data-toggle="modal"
  135. data-target="#close-account-modal">Close Account</a>
  136. This will permanently remove your healthchecks.io account
  137. <form action="{% url 'hc-close' %}" method="post">
  138. </form>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <div id="revoke-api-key-modal" class="modal">
  144. <div class="modal-dialog">
  145. <form id="revoke-api-key-form" method="post">
  146. {% csrf_token %}
  147. <div class="modal-content">
  148. <div class="modal-header">
  149. <button type="button" class="close" data-dismiss="modal">&times;</button>
  150. <h4 class="remove-check-title">Revoke API Key?</h4>
  151. </div>
  152. <div class="modal-body">
  153. <p>You are about to revoke the current API key.</p>
  154. <p>Afterwards, you can create a new API key, but there will
  155. be <strong>no way of getting the current API
  156. key back</strong>.
  157. </p>
  158. <p>Are you sure?</p>
  159. </div>
  160. <div class="modal-footer">
  161. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  162. <button
  163. type="submit"
  164. name="revoke_api_key"
  165. class="btn btn-danger">Revoke API Key</button>
  166. </div>
  167. </div>
  168. </form>
  169. </div>
  170. </div>
  171. <div id="remove-team-member-modal" class="modal">
  172. <div class="modal-dialog">
  173. <form id="remove-team-member-form" method="post">
  174. {% csrf_token %}
  175. <div class="modal-content">
  176. <div class="modal-header">
  177. <button type="button" class="close" data-dismiss="modal">&times;</button>
  178. <h4 class="remove-check-title">Remove Team Member</h4>
  179. </div>
  180. <div class="modal-body">
  181. <p>You are about to remove <span id="rtm-email"></span> from the team.</p>
  182. <p>Are you sure?</p>
  183. <input
  184. type="hidden"
  185. name="email"
  186. id="remove-team-member-email" />
  187. </div>
  188. <div class="modal-footer">
  189. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  190. <button
  191. type="submit"
  192. name="remove_team_member"
  193. class="btn btn-danger">Remove Member from Team</button>
  194. </div>
  195. </div>
  196. </form>
  197. </div>
  198. </div>
  199. <div id="invite-team-member-modal" class="modal">
  200. <div class="modal-dialog">
  201. <form method="post" class="form-horizontal">
  202. {% csrf_token %}
  203. <div class="modal-content">
  204. <div class="modal-header">
  205. <button type="button" class="close" data-dismiss="modal">&times;</button>
  206. <h4 class="remove-check-title">Invite a Team Member</h4>
  207. </div>
  208. <div class="modal-body">
  209. <ul>
  210. <li>Team Members can create and manage Checks and Integrations</li>
  211. <li>Only the team owner (you) can view and edit billing settings</li>
  212. </ul>
  213. <div class="form-group">
  214. <label for="itm-email" class="col-sm-2 control-label">Email</label>
  215. <div class="col-sm-9">
  216. <input
  217. type="email"
  218. class="form-control"
  219. id="itm-email"
  220. name="email"
  221. placeholder="[email protected]">
  222. </div>
  223. </div>
  224. </div>
  225. <div class="modal-footer">
  226. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  227. <button
  228. type="submit"
  229. name="invite_team_member"
  230. class="btn btn-primary">Send Invite</button>
  231. </div>
  232. </div>
  233. </form>
  234. </div>
  235. </div>
  236. <div id="set-team-name-modal" class="modal">
  237. <div class="modal-dialog">
  238. <form method="post" class="form-horizontal">
  239. {% csrf_token %}
  240. <div class="modal-content">
  241. <div class="modal-header">
  242. <button type="button" class="close" data-dismiss="modal">&times;</button>
  243. <h4 class="remove-check-title">Set Team Name</h4>
  244. </div>
  245. <div class="modal-body">
  246. <div class="form-group">
  247. <label for="team-name" class="col-sm-4 control-label">Team Name</label>
  248. <div class="col-sm-7">
  249. <input
  250. type="text"
  251. class="form-control"
  252. id="team-name"
  253. name="team_name"
  254. value="{{ profile }}">
  255. </div>
  256. </div>
  257. </div>
  258. <div class="modal-footer">
  259. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  260. <button
  261. type="submit"
  262. name="set_team_name"
  263. class="btn btn-primary">Set Team Name</button>
  264. </div>
  265. </div>
  266. </form>
  267. </div>
  268. </div>
  269. <div id="close-account-modal" class="modal">
  270. <div class="modal-dialog">
  271. <form id="close-account-form" method="post" action="{% url 'hc-close' %}">
  272. {% csrf_token %}
  273. <div class="modal-content">
  274. <div class="modal-header">
  275. <button type="button" class="close" data-dismiss="modal">&times;</button>
  276. <h4 class="remove-check-title">Close Account?</h4>
  277. </div>
  278. <div class="modal-body">
  279. <p></p>
  280. <p>You are about to permanently remove
  281. the account <strong>{{ profile }}</strong> and all
  282. of its associated checks and integrations. Are you sure?
  283. </p>
  284. </div>
  285. <div class="modal-footer">
  286. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  287. <button
  288. type="submit"
  289. class="btn btn-danger">Close Account</button>
  290. </div>
  291. </div>
  292. </form>
  293. </div>
  294. </div>
  295. {% endblock %}
  296. {% block scripts %}
  297. {% compress js %}
  298. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  299. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  300. <script src="{% static 'js/profile.js' %}"></script>
  301. {% endcompress %}
  302. {% endblock %}