From c87f7eed3e330db57a4ee5fb8c4aad1ef669b7a9 Mon Sep 17 00:00:00 2001 From: phear Date: Wed, 14 Dec 2005 18:04:38 +0000 Subject: [PATCH] added a small cherrypy logout page. --- logout.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/logout.py b/logout.py index 5949eac..b386485 100644 --- a/logout.py +++ b/logout.py @@ -1,13 +1,21 @@ import database -import login -def process_form(req,form): - username = form["username"] - myuser = database.Users.byUsername(username) - myuser.sessionid = None - - login.main(req,form) - +from cherrypy import cpg +from cherrypy.lib import httptools -def main(req,form): - process_form(req,form) \ No newline at end of file + +class Logout: + def index(self): + try: + username = cpg.request.sessionMap["username"] + myuser = database.Users.byUsername(username) + myuser.sessionid = None + myuser.timeout = 0 + except: + return helper.cs_render("templates/not_logged_in.cs") + username = "" + #sessionid = cpg.request.sessionMap["_sessionId"] + # now let cookie expire + cpg.response.simpleCookie["WebGoSessionCookie"]["expires"] = 0 + httptools.redirect("/") + index.exposed = True \ No newline at end of file