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