aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/tui
diff options
context:
space:
mode:
authorArturo FilastoĢ€ <hellais@torproject.org>2011-08-11 22:32:12 +0200
committerArturo FilastoĢ€ <hellais@torproject.org>2011-08-11 22:32:12 +0200
commit9098dbd20065f0e8cdff2631a7e3e29ef89cf27d (patch)
tree16794f0dda87c50abfb109036f3ba13cce84c908 /packages/torouter-web/tui
parentcc32bd87b24f9c0bcb384a9cb772f46da9b35d00 (diff)
downloadtorouter-9098dbd20065f0e8cdff2631a7e3e29ef89cf27d.tar.gz
torouter-9098dbd20065f0e8cdff2631a7e3e29ef89cf27d.zip
Add logout functionality
Diffstat (limited to 'packages/torouter-web/tui')
-rw-r--r--packages/torouter-web/tui/controllers/main.py5
-rw-r--r--packages/torouter-web/tui/utils/session.py3
-rw-r--r--packages/torouter-web/tui/views/base.html1
-rw-r--r--packages/torouter-web/tui/views/logout.html1
4 files changed, 10 insertions, 0 deletions
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)
<li><a href="/">Home</a></li>
<li><a href="/network">Network</a></li>
<li><a href="/tor">Tor</a></li>
+ <li><a href="/logout">logout</a></li>
</ul>
$:submenu
</div>
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!