Beispiel #1
0
def doLogout(req):
    cookie = PoorSession(req)
    if not "id" in cookie.data:
        req.log_error("Login cookie not found.", LOG_INFO)
        return
    
    cookie.destroy()
    cookie.header(req, req.headers_out)
    req.log_error("Login cookie was be destroyed (Logout)", LOG_INFO)
Beispiel #2
0
def doLogout(req):
    cookie = PoorSession(req)
    if not "id" in cookie.data:
        req.log_error("Login cookie not found.", LOG_INFO)
        return

    cookie.destroy()
    cookie.header(req, req.headers_out)
    req.log_error("Login cookie was be destroyed (Logout)", LOG_INFO)
Beispiel #3
0
def checkLogin(req, redirectUri = None):
    cookie = PoorSession(req)
    if not "id" in cookie.data:
        req.log_error("Login cookie not found.", LOG_INFO)
        if redirectUri:
            redirect(req, redirectUri)
        return None

    if "ip" in cookie.data and cookie.data["ip"] != req.get_remote_host():
        cookie.destroy()
        cookie.header(req, req.headers_out)
        req.log_error("Login cookie was be destroyed (invalid IP address)",
                LOG_INFO)
        if redirectUri:
            redirect(req, redirectUri)
        return None

    return cookie
Beispiel #4
0
def checkLogin(req, redirectUri=None):
    cookie = PoorSession(req)
    if not "id" in cookie.data:
        req.log_error("Login cookie not found.", LOG_INFO)
        if redirectUri:
            redirect(req, redirectUri)
        return None

    if "ip" in cookie.data and cookie.data["ip"] != req.get_remote_host():
        cookie.destroy()
        cookie.header(req, req.headers_out)
        req.log_error("Login cookie was be destroyed (invalid IP address)",
                      LOG_INFO)
        if redirectUri:
            redirect(req, redirectUri)
        return None

    return cookie