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.

327 lines
12 KiB

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