logout.py 662 B

1234567891011121314151617181920212223
  1. """Tornado handlers for logging out of the notebook.
  2. """
  3. # Copyright (c) Jupyter Development Team.
  4. # Distributed under the terms of the Modified BSD License.
  5. from ..base.handlers import IPythonHandler
  6. class LogoutHandler(IPythonHandler):
  7. def get(self):
  8. self.clear_login_cookie()
  9. if self.login_available:
  10. message = {'info': 'Successfully logged out.'}
  11. else:
  12. message = {'warning': 'Cannot log out. Notebook authentication '
  13. 'is disabled.'}
  14. self.write(self.render_template('logout.html',
  15. message=message))
  16. default_handlers = [(r"/logout", LogoutHandler)]