diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 43d86b7..9df4b2e 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -196,6 +196,13 @@ class LoginHandler(AuthenticatedHandler): self.redirect(self.get_argument('next', default='/')) +class LogoutHandler(AuthenticatedHandler): + + def get(self): + self.clear_cookie('username') + self.render('logout.html') + + class NewHandler(AuthenticatedHandler): @web.authenticated diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 157e856..8b5d9e0 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -40,7 +40,7 @@ from tornado import web # Our own libraries from .kernelmanager import MappingKernelManager -from .handlers import (LoginHandler, +from .handlers import (LoginHandler, LogoutHandler, ProjectDashboardHandler, NewHandler, NamedNotebookHandler, MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, ShellHandler, NotebookRootHandler, NotebookHandler, RSTHandler @@ -87,6 +87,7 @@ class NotebookWebApplication(web.Application): handlers = [ (r"/", ProjectDashboardHandler), (r"/login", LoginHandler), + (r"/logout", LogoutHandler), (r"/new", NewHandler), (r"/%s" % _notebook_id_regex, NamedNotebookHandler), (r"/kernels", MainKernelHandler), diff --git a/IPython/frontend/html/notebook/static/js/loginwidget.js b/IPython/frontend/html/notebook/static/js/loginwidget.js index 17fcc58..6ba8075 100644 --- a/IPython/frontend/html/notebook/static/js/loginwidget.js +++ b/IPython/frontend/html/notebook/static/js/loginwidget.js @@ -21,12 +21,12 @@ var IPython = (function (IPython) { }; LoginWidget.prototype.style = function () { - this.element.find('button#login').button(); + this.element.find('button#logout').button(); }; LoginWidget.prototype.bind_events = function () { var that = this; - this.element.find("button#login").click(function () { - window.location = "/login?next="+location.pathname; + this.element.find("button#logout").click(function () { + window.location = "/logout"; }); }; diff --git a/IPython/frontend/html/notebook/templates/layout.html b/IPython/frontend/html/notebook/templates/layout.html index db4603f..9235a6b 100644 --- a/IPython/frontend/html/notebook/templates/layout.html +++ b/IPython/frontend/html/notebook/templates/layout.html @@ -13,16 +13,17 @@ {% block stylesheet %} {% end %} - + {% block meta %} + {% end %} - + diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 9caf872..a893848 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -5,7 +5,17 @@ IPython Dashboard {% end %} {% block stylesheet %} - + +{% end %} + +{% block meta %} + +{% end %} + +{% block params %} +data-project={{project}} +data-base-project-url={{base_project_url}} +data-base-kernel-url={{base_kernel_url}} {% end %} {% block content_panel %} @@ -21,6 +31,6 @@ IPython Dashboard {% end %} {% block script %} - - + + {% end %}