added a small cherrypy logout page.
This commit is contained in:
parent
1e1ffa362e
commit
c87f7eed3e
1 changed files with 18 additions and 10 deletions
26
logout.py
26
logout.py
|
@ -1,13 +1,21 @@
|
||||||
import database
|
import database
|
||||||
import login
|
|
||||||
|
|
||||||
def process_form(req,form):
|
from cherrypy import cpg
|
||||||
username = form["username"]
|
from cherrypy.lib import httptools
|
||||||
|
|
||||||
|
|
||||||
|
class Logout:
|
||||||
|
def index(self):
|
||||||
|
try:
|
||||||
|
username = cpg.request.sessionMap["username"]
|
||||||
myuser = database.Users.byUsername(username)
|
myuser = database.Users.byUsername(username)
|
||||||
myuser.sessionid = None
|
myuser.sessionid = None
|
||||||
|
myuser.timeout = 0
|
||||||
login.main(req,form)
|
except:
|
||||||
|
return helper.cs_render("templates/not_logged_in.cs")
|
||||||
|
username = ""
|
||||||
def main(req,form):
|
#sessionid = cpg.request.sessionMap["_sessionId"]
|
||||||
process_form(req,form)
|
# now let cookie expire
|
||||||
|
cpg.response.simpleCookie["WebGoSessionCookie"]["expires"] = 0
|
||||||
|
httptools.redirect("/")
|
||||||
|
index.exposed = True
|
Loading…
Reference in a new issue