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.

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