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.

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