def process_logout(): connection = pymongo.Connection(connection_string, safe=True) cookie = bottle.request.get_cookie("session") if (cookie == None): print "no cookie..." bottle.redirect("/signup") else: session_id = user.check_secure_val(cookie) if (session_id == None): print "no secure session_id" bottle.redirect("/signup") else: # remove the session user.end_session(connection, session_id) print "clearing the cookie" bottle.response.set_cookie("session","") bottle.redirect("/signup")
def signout(): cookie = request.cookies.get(COOKIE, None) session["logged_in"] = False session["username"] = None if cookie is None: return redirect_back("signin") else: session_id = user.check_secure_val(cookie) if session_id is None: return redirect_back("signin") else: connection = pymongo.Connection(CONNECTION_STRING, safe=True) user.end_session(connection[DATABASE], session_id) redirect_to_signin = redirect_back("signin") response = app.make_response(redirect_to_signin) response.set_cookie(COOKIE, value="") return response