##// END OF EJS Templates
Add logout button.
Stefan van der Walt -
Show More
@@ -0,0 +1,5 b''
1 {% extends layout.html %}
2
3 {% block content_panel %}
4 You've been successfully logged out.
5 {% end %}
@@ -196,6 +196,13 b' class LoginHandler(AuthenticatedHandler):'
196 self.redirect(self.get_argument('next', default='/'))
196 self.redirect(self.get_argument('next', default='/'))
197
197
198
198
199 class LogoutHandler(AuthenticatedHandler):
200
201 def get(self):
202 self.clear_cookie('username')
203 self.render('logout.html')
204
205
199 class NewHandler(AuthenticatedHandler):
206 class NewHandler(AuthenticatedHandler):
200
207
201 @web.authenticated
208 @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),
@@ -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#login').button();
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#login").click(function () {
28 this.element.find("button#logout").click(function () {
29 window.location = "/login?next="+location.pathname;
29 window.location = "/logout";
30 });
30 });
31 };
31 };
32
32
@@ -13,16 +13,17 b''
13 {% block stylesheet %}
13 {% block stylesheet %}
14 {% end %}
14 {% end %}
15
15
16 <meta name="read_only" content="{{read_only}}"/>
16 {% block meta %}
17 {% end %}
17
18
18 </head>
19 </head>
19
20
20 <body>
21 <body {% block params %}{% end %}>
21
22
22 <div id="header">
23 <div id="header">
23 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
24 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
24 <span id="login_widget" class="hidden">
25 <span id="login_widget">
25 <button id="login">Login</button>
26 <button id="logout">Logout</button>
26 </span>
27 </span>
27 {% block header %}
28 {% block header %}
28 {% end %}
29 {% end %}
@@ -59,8 +59,8 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 <span id="login_widget">
63 <button id="login">Login</button>
63 <button id="logout">Logout</button>
64 </span>
64 </span>
65 <span id="kernel_status">Idle</span>
65 <span id="kernel_status">Idle</span>
66 </div>
66 </div>
@@ -5,7 +5,17 b' IPython Dashboard'
5 {% end %}
5 {% end %}
6
6
7 {% block stylesheet %}
7 {% block stylesheet %}
8 <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 %}
10
11 {% block meta %}
12 <meta name="read_only" content="{{read_only}}"/>
13 {% end %}
14
15 {% block params %}
16 data-project={{project}}
17 data-base-project-url={{base_project_url}}
18 data-base-kernel-url={{base_kernel_url}}
9 {% end %}
19 {% end %}
10
20
11 {% block content_panel %}
21 {% block content_panel %}
@@ -21,6 +31,6 b' IPython Dashboard'
21 {% end %}
31 {% end %}
22
32
23 {% block script %}
33 {% block script %}
24 <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
34 <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
25 <script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script>
35 <script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script>
26 {% end %}
36 {% end %}
General Comments 0
You need to be logged in to leave comments. Login now