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.

368 lines
14 KiB

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