added a small cherrypy logout page.

This commit is contained in:
phear 2005-12-14 18:04:38 +00:00
parent 1e1ffa362e
commit c87f7eed3e

View file

@ -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)
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