Show More
@@ -0,0 +1,77 b'' | |||||
|
1 | <!DOCTYPE HTML> | |||
|
2 | <html> | |||
|
3 | ||||
|
4 | <head> | |||
|
5 | <meta charset="utf-8"> | |||
|
6 | ||||
|
7 | <title>{% block title %}IPython Notebook{% end %}</title> | |||
|
8 | ||||
|
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> | |||
|
10 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> | |||
|
11 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> | |||
|
12 | <link rel="stylesheet" href="static/css/base.css" type="text/css"/> | |||
|
13 | {% block stylesheet %} | |||
|
14 | {% end %} | |||
|
15 | ||||
|
16 | {% block meta %} | |||
|
17 | {% end %} | |||
|
18 | ||||
|
19 | </head> | |||
|
20 | ||||
|
21 | <body {% block params %}{% end %}> | |||
|
22 | ||||
|
23 | <div id="header"> | |||
|
24 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> | |||
|
25 | <span id="login_widget"> | |||
|
26 | {% if current_user and current_user != 'anonymous' %} | |||
|
27 | <button id="logout">Logout</button> | |||
|
28 | {% end %} | |||
|
29 | </span> | |||
|
30 | {% block header %} | |||
|
31 | {% end %} | |||
|
32 | </div> | |||
|
33 | ||||
|
34 | <div id="header_border"></div> | |||
|
35 | ||||
|
36 | <div id="main_app"> | |||
|
37 | ||||
|
38 | <div id="app_hbox"> | |||
|
39 | ||||
|
40 | <div id="left_panel"> | |||
|
41 | {% block left_panel %} | |||
|
42 | {% end %} | |||
|
43 | </div> | |||
|
44 | ||||
|
45 | <div id="content_panel"> | |||
|
46 | {% if message %} | |||
|
47 | ||||
|
48 | {% for key in message %} | |||
|
49 | <div class="message {{key}}"> | |||
|
50 | {{message[key]}} | |||
|
51 | </div> | |||
|
52 | {% end %} | |||
|
53 | {% end %} | |||
|
54 | ||||
|
55 | {% block content_panel %} | |||
|
56 | {% end %} | |||
|
57 | </div> | |||
|
58 | <div id="right_panel"> | |||
|
59 | {% block right_panel %} | |||
|
60 | {% end %} | |||
|
61 | </div> | |||
|
62 | ||||
|
63 | </div> | |||
|
64 | ||||
|
65 | </div> | |||
|
66 | ||||
|
67 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> | |||
|
68 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> | |||
|
69 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> | |||
|
70 | <script src="static/js/loginmain.js" type="text/javascript" charset="utf-8"></script> | |||
|
71 | <script src="static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> | |||
|
72 | {% block script %} | |||
|
73 | {% end %} | |||
|
74 | ||||
|
75 | </body> | |||
|
76 | ||||
|
77 | </html> |
@@ -0,0 +1,5 b'' | |||||
|
1 | {% extends layout.html %} | |||
|
2 | ||||
|
3 | {% block content_panel %} | |||
|
4 | Proceed to the <a href="/login">login page</a>. | |||
|
5 | {% end %} |
@@ -116,7 +116,14 b' def authenticate_unless_readonly(f, self, *args, **kwargs):' | |||||
116 | # Top-level handlers |
|
116 | # Top-level handlers | |
117 | #----------------------------------------------------------------------------- |
|
117 | #----------------------------------------------------------------------------- | |
118 |
|
118 | |||
119 |
class |
|
119 | class RequestHandler(web.RequestHandler): | |
|
120 | """RequestHandler with default variable setting.""" | |||
|
121 | ||||
|
122 | def render(*args, **kwargs): | |||
|
123 | kwargs.setdefault('message', '') | |||
|
124 | return web.RequestHandler.render(*args, **kwargs) | |||
|
125 | ||||
|
126 | class AuthenticatedHandler(RequestHandler): | |||
120 | """A RequestHandler with an authenticated user.""" |
|
127 | """A RequestHandler with an authenticated user.""" | |
121 |
|
128 | |||
122 | def get_current_user(self): |
|
129 | def get_current_user(self): | |
@@ -167,7 +174,7 b' class ProjectDashboardHandler(AuthenticatedHandler):' | |||||
167 |
|
174 | |||
168 | class LoginHandler(AuthenticatedHandler): |
|
175 | class LoginHandler(AuthenticatedHandler): | |
169 |
|
176 | |||
170 |
def _render(self, message= |
|
177 | def _render(self, message=None): | |
171 | self.render('login.html', |
|
178 | self.render('login.html', | |
172 | next=self.get_argument('next', default='/'), |
|
179 | next=self.get_argument('next', default='/'), | |
173 | read_only=self.read_only, |
|
180 | read_only=self.read_only, | |
@@ -175,7 +182,10 b' class LoginHandler(AuthenticatedHandler):' | |||||
175 | ) |
|
182 | ) | |
176 |
|
183 | |||
177 | def get(self): |
|
184 | def get(self): | |
178 |
self. |
|
185 | if self.current_user: | |
|
186 | self.redirect(self.get_argument('next', default='/')) | |||
|
187 | else: | |||
|
188 | self._render() | |||
179 |
|
189 | |||
180 | def post(self): |
|
190 | def post(self): | |
181 | pwd = self.get_argument('password', default=u'') |
|
191 | pwd = self.get_argument('password', default=u'') | |
@@ -183,12 +193,19 b' class LoginHandler(AuthenticatedHandler):' | |||||
183 | if passwd_check(self.application.password, pwd): |
|
193 | if passwd_check(self.application.password, pwd): | |
184 | self.set_secure_cookie('username', str(uuid.uuid4())) |
|
194 | self.set_secure_cookie('username', str(uuid.uuid4())) | |
185 | else: |
|
195 | else: | |
186 | self._render(message='Invalid password') |
|
196 | self._render(message={'error': 'Invalid password'}) | |
187 | return |
|
197 | return | |
188 |
|
198 | |||
189 | self.redirect(self.get_argument('next', default='/')) |
|
199 | self.redirect(self.get_argument('next', default='/')) | |
190 |
|
200 | |||
191 |
|
201 | |||
|
202 | class LogoutHandler(AuthenticatedHandler): | |||
|
203 | ||||
|
204 | def get(self): | |||
|
205 | self.clear_cookie('username') | |||
|
206 | self.render('logout.html', message={'info': 'Successfully logged out.'}) | |||
|
207 | ||||
|
208 | ||||
192 | class NewHandler(AuthenticatedHandler): |
|
209 | class NewHandler(AuthenticatedHandler): | |
193 |
|
210 | |||
194 | @web.authenticated |
|
211 | @web.authenticated |
@@ -40,7 +40,7 b' from tornado import web' | |||||
40 |
|
40 | |||
41 | # Our own libraries |
|
41 | # Our own libraries | |
42 | from .kernelmanager import MappingKernelManager |
|
42 | from .kernelmanager import MappingKernelManager | |
43 | from .handlers import (LoginHandler, |
|
43 | from .handlers import (LoginHandler, LogoutHandler, | |
44 | ProjectDashboardHandler, NewHandler, NamedNotebookHandler, |
|
44 | ProjectDashboardHandler, NewHandler, NamedNotebookHandler, | |
45 | MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, |
|
45 | MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, | |
46 | ShellHandler, NotebookRootHandler, NotebookHandler, RSTHandler |
|
46 | ShellHandler, NotebookRootHandler, NotebookHandler, RSTHandler | |
@@ -87,6 +87,7 b' class NotebookWebApplication(web.Application):' | |||||
87 | handlers = [ |
|
87 | handlers = [ | |
88 | (r"/", ProjectDashboardHandler), |
|
88 | (r"/", ProjectDashboardHandler), | |
89 | (r"/login", LoginHandler), |
|
89 | (r"/login", LoginHandler), | |
|
90 | (r"/logout", LogoutHandler), | |||
90 | (r"/new", NewHandler), |
|
91 | (r"/new", NewHandler), | |
91 | (r"/%s" % _notebook_id_regex, NamedNotebookHandler), |
|
92 | (r"/%s" % _notebook_id_regex, NamedNotebookHandler), | |
92 | (r"/kernels", MainKernelHandler), |
|
93 | (r"/kernels", MainKernelHandler), |
@@ -102,12 +102,27 b'' | |||||
102 | box-pack: center; |
|
102 | box-pack: center; | |
103 | } |
|
103 | } | |
104 |
|
104 | |||
105 |
|
|
105 | .message { | |
106 |
border: 1px |
|
106 | border-width: 1px; | |
107 | background-color: #FFD3D1; |
|
107 | border-style: solid; | |
108 | text-align: center; |
|
108 | text-align: center; | |
109 | padding: 0.5em; |
|
109 | padding: 0.5em; | |
110 | margin: 0.5em; |
|
110 | margin: 0.5em 0; | |
|
111 | } | |||
|
112 | ||||
|
113 | .message.error { | |||
|
114 | background-color: #FFD3D1; | |||
|
115 | border-color: red; | |||
|
116 | } | |||
|
117 | ||||
|
118 | .message.warning { | |||
|
119 | background-color: #FFD09E; | |||
|
120 | border-color: orange; | |||
|
121 | } | |||
|
122 | ||||
|
123 | .message.info { | |||
|
124 | background-color: #CBFFBA; | |||
|
125 | border-color: green; | |||
111 | } |
|
126 | } | |
112 |
|
127 | |||
113 | #content_panel { |
|
128 | #content_panel { |
@@ -21,12 +21,12 b' var IPython = (function (IPython) {' | |||||
21 | }; |
|
21 | }; | |
22 |
|
22 | |||
23 | LoginWidget.prototype.style = function () { |
|
23 | LoginWidget.prototype.style = function () { | |
24 |
this.element.find('button#log |
|
24 | this.element.find('button#logout').button(); | |
25 | }; |
|
25 | }; | |
26 | LoginWidget.prototype.bind_events = function () { |
|
26 | LoginWidget.prototype.bind_events = function () { | |
27 | var that = this; |
|
27 | var that = this; | |
28 |
this.element.find("button#log |
|
28 | this.element.find("button#logout").click(function () { | |
29 |
window.location = "/log |
|
29 | window.location = "/logout"; | |
30 | }); |
|
30 | }); | |
31 | }; |
|
31 | }; | |
32 |
|
32 |
@@ -1,61 +1,8 b'' | |||||
1 | <!DOCTYPE HTML> |
|
1 | {% extends layout.html %} | |
2 | <html> |
|
2 | ||
3 |
|
3 | {% block content_panel %} | ||
4 | <head> |
|
4 | <form action="/login?next={{url_escape(next)}}" method="post"> | |
5 | <meta charset="utf-8"> |
|
5 | Password: <input type="password" name="password"> | |
6 |
|
6 | <input type="submit" value="Sign in" id="signin"> | ||
7 | <title>IPython Notebook</title> |
|
7 | </form> | |
8 |
|
8 | {% end %} | ||
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> |
|
|||
10 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> |
|
|||
11 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> |
|
|||
12 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> |
|
|||
13 |
|
||||
14 | <meta name="read_only" content="{{read_only}}"/> |
|
|||
15 |
|
||||
16 | </head> |
|
|||
17 |
|
||||
18 | <body> |
|
|||
19 |
|
||||
20 | <div id="header"> |
|
|||
21 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
|||
22 | </div> |
|
|||
23 |
|
||||
24 | <div id="header_border"></div> |
|
|||
25 |
|
||||
26 | <div id="main_app"> |
|
|||
27 |
|
||||
28 | <div id="app_hbox"> |
|
|||
29 |
|
||||
30 | <div id="left_panel"> |
|
|||
31 | </div> |
|
|||
32 |
|
||||
33 | <div id="content_panel"> |
|
|||
34 | {% if message %} |
|
|||
35 | <div id="message"> |
|
|||
36 | {{message}} |
|
|||
37 | </div> |
|
|||
38 | {% end %} |
|
|||
39 |
|
||||
40 | <form action="/login?next={{url_escape(next)}}" method="post"> |
|
|||
41 | Password: <input type="password" name="password"> |
|
|||
42 | <input type="submit" value="Sign in" id="signin"> |
|
|||
43 | </form> |
|
|||
44 | </div> |
|
|||
45 | <div id="right_panel"> |
|
|||
46 | </div> |
|
|||
47 |
|
||||
48 | </div> |
|
|||
49 |
|
||||
50 | </div> |
|
|||
51 |
|
||||
52 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> |
|
|||
53 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> |
|
|||
54 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
|||
55 | <script src="static/js/loginmain.js" type="text/javascript" charset="utf-8"></script> |
|
|||
56 |
|
||||
57 | </body> |
|
|||
58 |
|
||||
59 | </html> |
|
|||
60 |
|
||||
61 |
|
@@ -59,9 +59,15 b'' | |||||
59 | <span id="quick_help_area"> |
|
59 | <span id="quick_help_area"> | |
60 | <button id="quick_help">Quick<u>H</u>elp</button> |
|
60 | <button id="quick_help">Quick<u>H</u>elp</button> | |
61 | </span> |
|
61 | </span> | |
62 | <span id="login_widget" class="hidden"> |
|
62 | ||
63 | <button id="login">Login</button> |
|
63 | <span id="login_widget"> | |
|
64 | {% comment This is a temporary workaround to hide the logout button %} | |||
|
65 | {% comment when appropriate until notebook.html is templated %} | |||
|
66 | {% if current_user and current_user != 'anonymous' %} | |||
|
67 | <button id="logout">Logout</button> | |||
|
68 | {% end %} | |||
64 | </span> |
|
69 | </span> | |
|
70 | ||||
65 | <span id="kernel_status">Idle</span> |
|
71 | <span id="kernel_status">Idle</span> | |
66 | </div> |
|
72 | </div> | |
67 |
|
73 |
@@ -1,69 +1,36 b'' | |||||
1 | <!DOCTYPE HTML> |
|
1 | {% extends layout.html %} | |
2 | <html> |
|
|||
3 |
|
2 | |||
4 | <head> |
|
3 | {% block title %} | |
5 | <meta charset="utf-8"> |
|
4 | IPython Dashboard | |
|
5 | {% end %} | |||
6 |
|
6 | |||
7 | <title>IPython Dashboard</title> |
|
7 | {% block stylesheet %} | |
8 |
|
||||
9 | <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" /> |
|
|||
10 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> |
|
|||
11 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> |
|
|||
12 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> |
|
|||
13 | <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" /> |
|
8 | <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" /> | |
|
9 | {% end %} | |||
14 |
|
10 | |||
|
11 | {% block meta %} | |||
15 | <meta name="read_only" content="{{read_only}}"/> |
|
12 | <meta name="read_only" content="{{read_only}}"/> | |
16 |
|
13 | {% end %} | ||
17 | </head> |
|
14 | ||
18 |
|
15 | {% block params %} | ||
19 | <body data-project={{project}} data-base-project-url={{base_project_url}} |
|
16 | data-project={{project}} | |
20 |
|
|
17 | data-base-project-url={{base_project_url}} | |
21 |
|
18 | data-base-kernel-url={{base_kernel_url}} | ||
22 | <div id="header"> |
|
19 | {% end %} | |
23 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
20 | ||
24 | <span id="login_widget" class="hidden"> |
|
21 | {% block content_panel %} | |
25 | <button id="login">Login</button> |
|
22 | <div id="content_toolbar"> | |
26 | </span> |
|
23 | <span id="drag_info">Drag files onto the list to import notebooks.</span> | |
27 | </div> |
|
24 | <span id="notebooks_buttons"> | |
28 |
|
25 | <button id="new_notebook">New Notebook</button> | ||
29 | <div id="header_border"></div> |
|
26 | </span> | |
30 |
|
||||
31 | <div id="main_app"> |
|
|||
32 |
|
||||
33 | <div id="app_hbox"> |
|
|||
34 |
|
||||
35 | <div id="left_panel"> |
|
|||
36 | </div> |
|
|||
37 |
|
||||
38 | <div id="content_panel"> |
|
|||
39 | <div id="content_toolbar"> |
|
|||
40 | <span id="drag_info">Drag files onto the list to import notebooks.</span> |
|
|||
41 | <span id="notebooks_buttons"> |
|
|||
42 | <button id="new_notebook">New Notebook</button> |
|
|||
43 | </span> |
|
|||
44 | </div> |
|
|||
45 | <div id="notebook_list"> |
|
|||
46 | <div id="project_name"><h2>{{project}}</h2></div> |
|
|||
47 | </div> |
|
|||
48 |
|
||||
49 | </div> |
|
27 | </div> | |
50 |
|
28 | <div id="notebook_list"> | ||
51 | <div id="right_panel"> |
|
29 | <div id="project_name"><h2>{{project}}</h2></div> | |
52 | </div> |
|
30 | </div> | |
53 |
|
31 | {% end %} | ||
54 | </div> |
|
|||
55 |
|
||||
56 | </div> |
|
|||
57 |
|
||||
58 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> |
|
|||
59 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> |
|
|||
60 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
|||
61 | <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script> |
|
|||
62 | <script src="static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> |
|
|||
63 | <script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script> |
|
|||
64 |
|
||||
65 | </body> |
|
|||
66 |
|
||||
67 | </html> |
|
|||
68 |
|
||||
69 |
|
32 | |||
|
33 | {% block script %} | |||
|
34 | <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script> | |||
|
35 | <script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script> | |||
|
36 | {% end %} |
General Comments 0
You need to be logged in to leave comments.
Login now