예제 #1
0
파일: __init__.py 프로젝트: goschtl/zope
def manage_zmi_logout(self, REQUEST, RESPONSE):
    """Logout current user"""
    p = getattr(REQUEST, '_logout_path', None)
    if p is not None:
        return apply(self.restrictedTraverse(p))

    acl_users = self.acl_users
    realm=RESPONSE.realm
    RESPONSE.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)

    if IPluggableAuthService.isImplementedBy(acl_users):
        acl_users.resetCredentials(REQUEST, RESPONSE)
    else:
        raise Unauthorized, '<p>You have been logged out.</p>'

    RESPONSE.setStatus(401)
    RESPONSE.setBody("""<html>
<head><title>Logout</title></head>
<body>
<p>
You have been logged out.
</p>
</body>
</html>""")
예제 #2
0
파일: __init__.py 프로젝트: bendavis78/zope
def manage_zmi_logout(self, REQUEST, RESPONSE):
    """Logout current user"""
    p = getattr(REQUEST, '_logout_path', None)
    if p is not None:
        return apply(self.restrictedTraverse(p))
    acl_users = self.acl_users
    if IPluggableAuthService.isImplementedBy(acl_users):
        acl_users.resetCredentials(REQUEST, RESPONSE)
    else:
        realm = RESPONSE.realm
        RESPONSE.setStatus(401)
        RESPONSE.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)
    referrer = REQUEST.get('HTTP_REFERER')  # HTTP_REFERER is optional header
    if referrer:
        REQUEST['RESPONSE'].redirect(referrer)
    else:
        RESPONSE.setBody("""<html>
<head><title>Logout</title></head>
<body>
<p>
You have been logged out.
</p>
</body>
</html>""")
예제 #3
0
def manage_zmi_logout(self, REQUEST, RESPONSE):
    """Logout current user"""
    p = getattr(REQUEST, '_logout_path', None)
    if p is not None:
        return apply(self.restrictedTraverse(p))

    acl_users = self.acl_users
    realm = RESPONSE.realm
    RESPONSE.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)

    if IPluggableAuthService.isImplementedBy(acl_users):
        acl_users.resetCredentials(REQUEST, RESPONSE)
    else:
        raise Unauthorized, '<p>You have been logged out.</p>'

    RESPONSE.setStatus(401)
    RESPONSE.setBody("""<html>
<head><title>Logout</title></head>
<body>
<p>
You have been logged out.
</p>
</body>
</html>""")
예제 #4
0
파일: __init__.py 프로젝트: goschtl/zope
def manage_zmi_logout(self, REQUEST, RESPONSE):
    """Logout current user"""
    p = getattr(REQUEST, '_logout_path', None)
    if p is not None:
        return apply(self.restrictedTraverse(p))
    acl_users = self.acl_users
    if IPluggableAuthService.isImplementedBy(acl_users):
        acl_users.resetCredentials(REQUEST, RESPONSE)
    else:
        realm=RESPONSE.realm
        RESPONSE.setStatus(401)
        RESPONSE.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)    
    referrer = REQUEST.get('HTTP_REFERER') # HTTP_REFERER is optional header
    if referrer:
        REQUEST['RESPONSE'].redirect(referrer)
    else:
        RESPONSE.setBody("""<html>
<head><title>Logout</title></head>
<body>
<p>
You have been logged out.
</p>
</body>
</html>""")