login.html 4.4 KB

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