2013-05-03 03:19:21 +08:00
|
|
|
"""Tornado handlers for logging out of the notebook.
|
2013-05-03 02:15:32 +08:00
|
|
|
|
|
|
|
Authors:
|
|
|
|
|
|
|
|
* Brian Granger
|
|
|
|
"""
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2013-05-03 03:19:21 +08:00
|
|
|
# Copyright (C) 2011 The IPython Development Team
|
2013-05-03 02:15:32 +08:00
|
|
|
#
|
|
|
|
# Distributed under the terms of the BSD License. The full license is in
|
|
|
|
# the file COPYING, distributed as part of this software.
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Imports
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
2013-05-16 03:25:33 +08:00
|
|
|
from ..base.handlers import IPythonHandler
|
2013-05-03 02:15:32 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2013-05-03 03:19:21 +08:00
|
|
|
# Handler
|
2013-05-03 02:15:32 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
class LogoutHandler(IPythonHandler):
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
self.clear_login_cookie()
|
|
|
|
if self.login_available:
|
|
|
|
message = {'info': 'Successfully logged out.'}
|
|
|
|
else:
|
|
|
|
message = {'warning': 'Cannot log out. Notebook authentication '
|
|
|
|
'is disabled.'}
|
|
|
|
self.write(self.render_template('logout.html',
|
|
|
|
message=message))
|
2013-05-16 01:55:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# URL to handler mappings
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
default_handlers = [(r"/logout", LogoutHandler)]
|