From 9098dbd20065f0e8cdff2631a7e3e29ef89cf27d Mon Sep 17 00:00:00 2001 From: Arturo FilastoĢ€ Date: Thu, 11 Aug 2011 22:32:12 +0200 Subject: Add logout functionality --- packages/torouter-web/runui.py | 3 ++- packages/torouter-web/tui/controllers/main.py | 5 +++++ packages/torouter-web/tui/utils/session.py | 3 +++ packages/torouter-web/tui/views/base.html | 1 + packages/torouter-web/tui/views/logout.html | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 packages/torouter-web/tui/views/logout.html (limited to 'packages/torouter-web') diff --git a/packages/torouter-web/runui.py b/packages/torouter-web/runui.py index 030bf91..3d2dfc8 100644 --- a/packages/torouter-web/runui.py +++ b/packages/torouter-web/runui.py @@ -20,7 +20,8 @@ urls = ( '/network/wired', 'tui.controllers.network.wired', '/network/status', 'tui.controllers.network.status', '/tor', 'tui.controllers.tor.status', - '/tor/config', 'tui.controllers.tor.config' + '/tor/config', 'tui.controllers.tor.config', + '/logout', 'tui.controllers.main.logout' ) # '/wizard/([0-9a-f]{1,2})?', 'tui.controllers.wizard.step', # '/status', 'tui.controllers.status') diff --git a/packages/torouter-web/tui/controllers/main.py b/packages/torouter-web/tui/controllers/main.py index 7e1df50..060caa6 100644 --- a/packages/torouter-web/tui/controllers/main.py +++ b/packages/torouter-web/tui/controllers/main.py @@ -19,3 +19,8 @@ class index: else: return render.base(render.login()) +class logout: + def GET(self): + session.logout() + return render.base(render.logout()) + diff --git a/packages/torouter-web/tui/utils/session.py b/packages/torouter-web/tui/utils/session.py index 61c04cd..a554dad 100644 --- a/packages/torouter-web/tui/utils/session.py +++ b/packages/torouter-web/tui/utils/session.py @@ -21,3 +21,6 @@ def check_login(data): return 0 return 1 +def logout(): + web.config._session.kill() + diff --git a/packages/torouter-web/tui/views/base.html b/packages/torouter-web/tui/views/base.html index aca2bf9..bce4110 100644 --- a/packages/torouter-web/tui/views/base.html +++ b/packages/torouter-web/tui/views/base.html @@ -13,6 +13,7 @@ $def with (page,submenu=None)
  • Home
  • Network
  • Tor
  • +
  • logout
  • $:submenu diff --git a/packages/torouter-web/tui/views/logout.html b/packages/torouter-web/tui/views/logout.html new file mode 100644 index 0000000..f027ed4 --- /dev/null +++ b/packages/torouter-web/tui/views/logout.html @@ -0,0 +1 @@ +Successfully logged out! -- cgit v1.2.3