admin_login.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {% extends 'admin/login.html' %}
  2. {% load admin_static browserid %}
  3. {% comment %}
  4. This Source Code Form is subject to the terms of the Mozilla Public
  5. License, v. 2.0. If a copy of the MPL was not distributed with this
  6. file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. {% endcomment %}
  8. {% block extrastyle %}
  9. {{ block.super }}
  10. {% browserid_css %}
  11. <style>
  12. a.persona-button:link,
  13. a.persona-button:visited {
  14. color: #FFF;
  15. }
  16. .persona-button-container {
  17. display: flex;
  18. float: left;
  19. justify-content: center;
  20. margin-top: 2em;
  21. width: 100%;
  22. }
  23. .seperator {
  24. background-color: #CCC;
  25. float: left;
  26. height: 1px;
  27. margin: 2em 0 0;
  28. overflow: visible;
  29. text-align: center;
  30. width: 100%;
  31. }
  32. .seperator-text {
  33. background-color: #FFF;
  34. padding: 2px;
  35. position: relative;
  36. top: -0.7em;
  37. }
  38. #persona-error {
  39. background-color: #FCF8E3;
  40. border: 1px solid #FAEBCC;
  41. color: #8A6D3B;
  42. display: none;
  43. float: left;
  44. margin: 2em 0 0;
  45. padding: 10px 8px;
  46. width
  47. }
  48. </style>
  49. {% endblock %}
  50. {% block content %}
  51. {% browserid_info %}
  52. {% if include_password_form %}
  53. {{ block.super }}
  54. <div class="seperator">
  55. <span class="seperator-text">or</span>
  56. </div>
  57. {% endif %}
  58. <div class="persona-button-container">
  59. {% browserid_login text='Sign in with email' color='dark' next=app_path link_class='admin-browserid-login' %}
  60. </div>
  61. <div id="persona-error">There was a problem signing you in. Please try again.</div>
  62. <script src="{% static 'browserid/jquery-1.10.2.min.js' %}"></script>
  63. <script type="text/javascript" src="https://login.persona.org/include.js"></script>
  64. <script src="{% static 'browserid/api.js' %}"></script>
  65. <script>
  66. django_browserid.registerWatchHandlers();
  67. $(document).on('click', '.admin-browserid-login', function(e) {
  68. e.preventDefault();
  69. var $link = $(this);
  70. var $error = $('#persona-error');
  71. $error.slideUp(500);
  72. django_browserid.login().then(function(verifyResult) {
  73. window.location = $link.data('next');
  74. }, function(jqXHR) {
  75. $error.slideDown(500);
  76. });
  77. });
  78. </script>
  79. {% endblock %}