[tor-commits] [torouter/master] Require login for tor status page

hellais at torproject.org hellais at torproject.org
Wed Aug 24 16:22:50 UTC 2011


commit 817713dc33ae88217b61c73d4b9b0446a1a89855
Author: Arturo Filastò <hellais at torproject.org>
Date:   Wed Aug 24 18:22:37 2011 +0200

    Require login for tor status page
---
 packages/torouter-web/src/tui/controllers/tor.py |   32 ++++++++++++++-------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/packages/torouter-web/src/tui/controllers/tor.py b/packages/torouter-web/src/tui/controllers/tor.py
index 491c6b7..e671d80 100644
--- a/packages/torouter-web/src/tui/controllers/tor.py
+++ b/packages/torouter-web/src/tui/controllers/tor.py
@@ -9,16 +9,23 @@ The main Tor status page
 """
 class status:
   def GET(self):
-    trc = parsing.torrc(config.torrc_file)
-    trc.parse()
-    output = trc.html_output()
-    return render.base(render.torstatus(output,config.torrc_file))
+    if session.is_logged() > 0:
+      trc = parsing.torrc(config.torrc_file)
+      trc.parse()
+      output = trc.html_output()
+      return render.base(render.torstatus(output,config.torrc_file))
+    else:
+      return render.base(render.login())
+
 
   def POST(self):
-    trc = parsing.torrc(config.torrc_file)
-    trc.parse()
-    output = trc.html_output()
-    return render.base(render.torstatus(output,config.torrc_file))
+    if session.is_logged() > 0:
+      trc = parsing.torrc(config.torrc_file)
+      trc.parse()
+      output = trc.html_output()
+      return render.base(render.torstatus(output,config.torrc_file))
+    else:
+      return render.base(render.login())
 
 """
 Tor configuration page
@@ -32,9 +39,12 @@ class torrc:
     return True
 
   def GET(self):
-    trc = parsing.torrc(config.torrc_file)
-    output = trc.output()
-    return render.base(render.torconfig(output))
+    if session.is_logged() > 0:
+      trc = parsing.torrc(config.torrc_file)
+      output = trc.output()
+      return render.base(render.torconfig(output))
+    else:
+      return render.base(render.login())
 
   def POST(self):
     if session.is_logged() > 0:



More information about the tor-commits mailing list