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.

365 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
  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. {% endif %}
  126. <br />
  127. {% if not profile.can_invite %}
  128. <div class="alert alert-info">
  129. <strong>Team size limit reached.</strong>
  130. To invite more members to your team, please
  131. <a href="{% url 'hc-pricing' %}">upgrade your account!</a>
  132. </div>
  133. {% endif %}
  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. {% if profile.can_invite %}
  140. <a
  141. href="#"
  142. class="btn btn-primary pull-right"
  143. data-toggle="modal"
  144. data-target="#invite-team-member-modal">Invite a Team Member</a>
  145. {% endif %}
  146. </div>
  147. {% if team_member_invited %}
  148. <div class="panel-footer">
  149. {{ team_member_invited }} invited to team
  150. </div>
  151. {% endif %}
  152. {% if team_member_removed %}
  153. <div class="panel-footer">
  154. {{ team_member_removed }} removed from team
  155. </div>
  156. {% endif %}
  157. {% if team_name_updated %}
  158. <div class="panel-footer">
  159. Team name updated
  160. </div>
  161. {% endif %}
  162. </div>
  163. <div class="panel panel-default">
  164. <div class="panel-body settings-block">
  165. {% csrf_token %}
  166. <h2>Close Account</h2>
  167. <a
  168. id="close-account"
  169. href="#"
  170. class="btn btn-default pull-right"
  171. data-toggle="modal"
  172. data-target="#close-account-modal">Close Account</a>
  173. This will permanently remove your healthchecks.io account
  174. <form action="{% url 'hc-close' %}" method="post">
  175. </form>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <div id="revoke-api-key-modal" class="modal">
  181. <div class="modal-dialog">
  182. <form id="revoke-api-key-form" method="post">
  183. {% csrf_token %}
  184. <div class="modal-content">
  185. <div class="modal-header">
  186. <button type="button" class="close" data-dismiss="modal">&times;</button>
  187. <h4 class="remove-check-title">Revoke API Key?</h4>
  188. </div>
  189. <div class="modal-body">
  190. <p>You are about to revoke the current API key.</p>
  191. <p>Afterwards, you can create a new API key, but there will
  192. be <strong>no way of getting the current API
  193. key back</strong>.
  194. </p>
  195. <p>Are you sure?</p>
  196. </div>
  197. <div class="modal-footer">
  198. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  199. <button
  200. type="submit"
  201. name="revoke_api_key"
  202. class="btn btn-danger">Revoke API Key</button>
  203. </div>
  204. </div>
  205. </form>
  206. </div>
  207. </div>
  208. <div id="remove-team-member-modal" class="modal">
  209. <div class="modal-dialog">
  210. <form id="remove-team-member-form" method="post">
  211. {% csrf_token %}
  212. <div class="modal-content">
  213. <div class="modal-header">
  214. <button type="button" class="close" data-dismiss="modal">&times;</button>
  215. <h4 class="remove-check-title">Remove Team Member</h4>
  216. </div>
  217. <div class="modal-body">
  218. <p>You are about to remove <span id="rtm-email"></span> from the team.</p>
  219. <p>Are you sure?</p>
  220. <input
  221. type="hidden"
  222. name="email"
  223. id="remove-team-member-email" />
  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="remove_team_member"
  230. class="btn btn-danger">Remove Member from Team</button>
  231. </div>
  232. </div>
  233. </form>
  234. </div>
  235. </div>
  236. <div id="invite-team-member-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">Invite a Team Member</h4>
  244. </div>
  245. <div class="modal-body">
  246. <ul>
  247. <li>Team Members can create and manage Checks and Integrations</li>
  248. <li>Only the team owner (you) can view and edit billing settings</li>
  249. </ul>
  250. <div class="form-group">
  251. <label for="itm-email" class="col-sm-2 control-label">Email</label>
  252. <div class="col-sm-9">
  253. <input
  254. type="email"
  255. class="form-control"
  256. id="itm-email"
  257. name="email"
  258. placeholder="[email protected]">
  259. </div>
  260. </div>
  261. </div>
  262. <div class="modal-footer">
  263. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  264. <button
  265. type="submit"
  266. name="invite_team_member"
  267. class="btn btn-primary">Send Invite</button>
  268. </div>
  269. </div>
  270. </form>
  271. </div>
  272. </div>
  273. <div id="set-team-name-modal" class="modal">
  274. <div class="modal-dialog">
  275. <form method="post" class="form-horizontal">
  276. {% csrf_token %}
  277. <div class="modal-content">
  278. <div class="modal-header">
  279. <button type="button" class="close" data-dismiss="modal">&times;</button>
  280. <h4 class="remove-check-title">Set Team Name</h4>
  281. </div>
  282. <div class="modal-body">
  283. <div class="form-group">
  284. <label for="team-name" class="col-sm-4 control-label">Team Name</label>
  285. <div class="col-sm-7">
  286. <input
  287. type="text"
  288. class="form-control"
  289. id="team-name"
  290. name="team_name"
  291. value="{{ profile }}">
  292. </div>
  293. </div>
  294. </div>
  295. <div class="modal-footer">
  296. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  297. <button
  298. type="submit"
  299. name="set_team_name"
  300. class="btn btn-primary">Set Team Name</button>
  301. </div>
  302. </div>
  303. </form>
  304. </div>
  305. </div>
  306. <div id="close-account-modal" class="modal">
  307. <div class="modal-dialog">
  308. <form id="close-account-form" method="post" action="{% url 'hc-close' %}">
  309. {% csrf_token %}
  310. <div class="modal-content">
  311. <div class="modal-header">
  312. <button type="button" class="close" data-dismiss="modal">&times;</button>
  313. <h4 class="remove-check-title">Close Account?</h4>
  314. </div>
  315. <div class="modal-body">
  316. <p></p>
  317. <p>You are about to permanently remove
  318. the account <strong>{{ profile }}</strong> and all
  319. of its associated checks and integrations. Are you sure?
  320. </p>
  321. </div>
  322. <div class="modal-footer">
  323. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  324. <button
  325. type="submit"
  326. class="btn btn-danger">Close Account</button>
  327. </div>
  328. </div>
  329. </form>
  330. </div>
  331. </div>
  332. {% endblock %}
  333. {% block scripts %}
  334. {% compress js %}
  335. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  336. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  337. <script src="{% static 'js/profile.js' %}"></script>
  338. {% endcompress %}
  339. {% endblock %}