login.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {% extends "page.html" %}
  2. {% block stylesheet %}
  3. {{super()}}
  4. <link rel="stylesheet" href="{{ static_url("auth/css/override.css") }}" type="text/css" />
  5. {% endblock %}
  6. {% block login_widget %}
  7. {% endblock %}
  8. {% block site %}
  9. <div id="ipython-main-app" class="container">
  10. {% if login_available %}
  11. {# login_available means password-login is allowed. Show the form. #}
  12. <div class="row">
  13. <div class="navbar col-sm-8">
  14. <div class="navbar-inner">
  15. <div class="container">
  16. <div class="center-nav">
  17. <form action="{{base_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
  18. {{ xsrf_form_html() | safe }}
  19. {% if token_available %}
  20. <label for="password_input"><strong>{% trans %}Password or token:{% endtrans %}</strong></label>
  21. {% else %}
  22. <label for="password_input"><strong>{% trans %}Password:{% endtrans %}</strong></label>
  23. {% endif %}
  24. <input type="password" name="password" id="password_input" class="form-control">
  25. <button type="submit" class="btn btn-default" id="login_submit">{% trans %}Log in{% endtrans %}</button>
  26. </form>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. {% else %}
  33. <p>{% trans %}No login available, you shouldn't be seeing this page.{% endtrans %}</p>
  34. {% endif %}
  35. {% if message %}
  36. <div class="row">
  37. {% for key in message %}
  38. <div class="message {{key}}">
  39. {{message[key]}}
  40. </div>
  41. {% endfor %}
  42. </div>
  43. {% endif %}
  44. {% if token_available %}
  45. {% block token_message %}
  46. <div class="col-sm-6 col-sm-offset-3 text-left rendered_html">
  47. <h3>
  48. Token authentication is enabled
  49. </h3>
  50. <p>
  51. If no password has been configured, you need to open the notebook
  52. server with its login token in the URL, or paste it above.
  53. This requirement will be lifted if you
  54. <b><a href='https://jupyter-notebook.readthedocs.io/en/stable/public_server.html'>
  55. enable a password</a></b>.
  56. </p>
  57. <p>
  58. The command:
  59. <pre>jupyter notebook list</pre>
  60. will show you the URLs of running servers with their tokens,
  61. which you can copy and paste into your browser. For example:
  62. </p>
  63. <pre>Currently running servers:
  64. http://localhost:8888/?token=c8de56fa... :: /Users/you/notebooks
  65. </pre>
  66. <p>
  67. or you can paste just the token value into the password field on this
  68. page.
  69. </p>
  70. <p>
  71. See
  72. <b><a
  73. href='https://jupyter-notebook.readthedocs.io/en/stable/public_server.html'>
  74. the documentation on how to enable a password</a>
  75. </b>
  76. in place of token authentication,
  77. if you would like to avoid dealing with random tokens.
  78. </p>
  79. <p>
  80. Cookies are required for authenticated access to notebooks.
  81. </p>
  82. {% if allow_password_change %}
  83. <h3>{% trans %}Setup a Password{% endtrans %}</h3>
  84. <p> You can also setup a password by entering your token and a new password
  85. on the fields below:</p>
  86. <form action="{{base_url}}login?next={{next}}" method="post" class="">
  87. {{ xsrf_form_html() | safe }}
  88. <div class="form-group">
  89. <label for="token_input"><h4>Token</h4></label>
  90. <input type="password" name="password" id="token_input" class="form-control">
  91. </div>
  92. <div class="form-group">
  93. <label for="new_password_input"><h4>New Password</h4></label>
  94. <input type="password" name="new_password" id="new_password_input" class="form-control" required>
  95. </div>
  96. <div class="form-group">
  97. <button type="submit" class="btn btn-default" id="login_new_pass_submit">{% trans %}Log in and set new password{% endtrans %}</button>
  98. </div>
  99. </form>
  100. {% endif %}
  101. </div>
  102. {% endblock token_message %}
  103. {% endif %}
  104. </div>
  105. {% endblock %}
  106. {% block script %}
  107. {{super()}}
  108. <script type="text/javascript">
  109. require(["auth/js/main"], function (auth) {
  110. auth.login_main();
  111. });
  112. </script>
  113. {% endblock %}