Ejemplo n.º 1
0
 def expire(self):
     value = {}
     cookie = Cookie.MarshalCookie(self.cookie_key,
                                   value,
                                   secret=str(
                                       self.captureSettings["secretKey"]))
     cookie.path = "/"
     cookie.expires = 0
     Cookie.add_cookie(self.req, cookie)
Ejemplo n.º 2
0
 def set(self, username):
     value = {"username": username}
     cookie = Cookie.MarshalCookie(self.cookie_key,
                                   value,
                                   secret=str(
                                       self.captureSettings["secretKey"]))
     cookie.path = "/"
     cookie.expires = time.time() + int(
         self.captureSettings["sessionCookiesTimeout"])
     Cookie.add_cookie(self.req, cookie)
Ejemplo n.º 3
0
def index(req):

    # get the network address of the client
    address = req.get_remote_host(apache.REMOTE_NOLOOKUP, None)

    # use the path from the request filename to locate the correct template
    name = req.filename[:req.filename.rindex('/')] + "/exitpage.html"
    file = open(name, "r")
    page = file.read()
    file.close()

    # load the app settings
    captureSettings = load_capture_settings(req)

    # setup the uvm and app objects so we can make the RPC call
    captureList = load_rpc_manager_list()

    # track the number of successful calls to userLogout
    exitCount = 0

    # call the logout function for each app instance
    cookie_key = "__ngfwcp"
    for app in captureList:
        exitResult = app.userLogout(address)
        cookies = Cookie.get_cookie(req, cookie_key)
        if cookies != None:
            value = {}
            cookie = Cookie.MarshalCookie(cookie_key,
                                          value,
                                          secret=str(
                                              captureSettings["secretKey"]))
            cookie.path = "/"
            cookie.expires = 0
            Cookie.add_cookie(req, cookie)

        if (exitResult == 0):
            exitCount = exitCount + 1

    if (exitCount == 0):
        page = replace_marker(page, '$.ExitMessage.$',
                              _('You were already logged out'))
        page = replace_marker(page, '$.ExitStyle.$', 'styleProblem')
    else:
        page = replace_marker(page, '$.ExitMessage.$',
                              _('You have successfully logged out'))
        page = replace_marker(page, '$.ExitStyle.$', 'styleNormal')

    page = replace_marker(page, '$.CompanyName.$',
                          captureSettings['companyName'])
    page = replace_marker(page, '$.PageTitle.$',
                          captureSettings['basicLoginPageTitle'])

    # return the logout page we just created
    return (page)