Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add logout button.

  • Loading branch information...
commit 0a260418803a1fde946ab1478927bbc02a73d25e 1 parent 233e9c0
@stefanv authored
View
7 IPython/frontend/html/notebook/handlers.py
@@ -196,6 +196,13 @@ def post(self):
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
View
3  IPython/frontend/html/notebook/notebookapp.py
@@ -40,7 +40,7 @@
# 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 @@ def __init__(self, ipython_app, kernel_manager, notebook_manager, log):
handlers = [
(r"/", ProjectDashboardHandler),
(r"/login", LoginHandler),
+ (r"/logout", LogoutHandler),
(r"/new", NewHandler),
(r"/%s" % _notebook_id_regex, NamedNotebookHandler),
(r"/kernels", MainKernelHandler),
View
6 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";
});
};
View
9 IPython/frontend/html/notebook/templates/layout.html
@@ -13,16 +13,17 @@
{% block stylesheet %}
{% end %}
- <meta name="read_only" content="{{read_only}}"/>
+ {% block meta %}
+ {% end %}
</head>
-<body>
+<body {% block params %}{% end %}>
<div id="header">
<span id="ipython_notebook"><h1>IPython Notebook</h1></span>
- <span id="login_widget" class="hidden">
- <button id="login">Login</button>
+ <span id="login_widget">
+ <button id="logout">Logout</button>
</span>
{% block header %}
{% end %}
View
5 IPython/frontend/html/notebook/templates/logout.html
@@ -0,0 +1,5 @@
+{% extends layout.html %}
+
+{% block content_panel %}
+You've been successfully logged out.
+{% end %}
View
4 IPython/frontend/html/notebook/templates/notebook.html
@@ -59,8 +59,8 @@
<span id="quick_help_area">
<button id="quick_help">Quick<u>H</u>elp</button>
</span>
- <span id="login_widget" class="hidden">
- <button id="login">Login</button>
+ <span id="login_widget">
+ <button id="logout">Logout</button>
</span>
<span id="kernel_status">Idle</span>
</div>
View
16 IPython/frontend/html/notebook/templates/projectdashboard.html
@@ -5,7 +5,17 @@
{% end %}
{% block stylesheet %}
- <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" />
+ <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" />
+{% end %}
+
+{% block meta %}
+ <meta name="read_only" content="{{read_only}}"/>
+{% 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 @@
{% end %}
{% block script %}
-<script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script>
+ <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
+ <script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script>
{% end %}
Please sign in to comment.
Something went wrong with that request. Please try again.