मेरे पास डिफ़ॉल्ट प्रमाणीकरण के साथ टीजी 2.2.2 में लिखा गया ऐप है। पिछले दिनों, मुझे लॉग इन और आउट करने में समस्या है। सफारी में, दो ऑथक्ट कुकीज़ तैयार की जाती हैं, एक "beta.domain.com", अन्य ".beta.domain.com" के रूप में। कॉलिंग/logout_handler के बाद, डोमेन "beta.domain.com" के लिए कुकी केवल हटा दी जाती है लेकिन जंगली डोमेन के लिए बनी हुई है। तो पृष्ठ को पुनः लोड करने के बाद, उपयोगकर्ता अभी भी लॉग इन है। स्थानीयहोस्ट पर भी उत्पादन हो रहा है।लॉगआउट टर्बोगियर्स में विफल रहता है 2.2.2
दिलचस्प बात यह है कि एक ही lib संस्करण पर अन्य एप्लिकेशन सामान्य रूप से काम करता है, साथ ही अन्य ब्राउज़रों में, वर्चुअलएन्व का उपयोग नहीं किया जाता है।
मुझे वास्तव में पता नहीं है कि समस्या कहां है, इसलिए अनुरोध किए जाने पर मुझे कोई कॉन्फ़िगरेशन फ़ाइल शामिल होगी। भिखारी पर, app_config शामिल है।
app_cfg.py
# -*- coding: utf-8 -*-
from tg.configuration import AppConfig
import cafeteria
from cafeteria import model
from cafeteria.lib import app_globals, helpers
base_config = AppConfig()
base_config.renderers = []
base_config.prefer_toscawidgets2 = True
base_config.package = cafeteria
base_config.renderers.append('json')
base_config.renderers.append('mako')
base_config.default_renderer = 'mako'
base_config.use_sqlalchemy = True
base_config.model = cafeteria.model
base_config.DBSession = cafeteria.model.DBSession
# Configure the authentication backend
# YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP
base_config.sa_auth.cookie_secret = "SOMESECRET"
base_config.auth_backend = 'sqlalchemy'
from tg.configuration.auth import TGAuthMetadata
# This tells to TurboGears how to retrieve the data for your user
class ApplicationAuthMetadata(TGAuthMetadata):
def __init__(self, sa_auth):
self.sa_auth = sa_auth
def get_user(self, identity, userid):
return self.sa_auth.dbsession.query(self.sa_auth.user_class).filter_by(user_name = userid).first()
def get_groups(self, identity, userid):
return (identity['user'].group.name,) if identity['user'].group_id else []
def get_permissions(self, identity, userid):
return [p.name for p in identity['user'].group.permissions] if identity['user'].group_id else []
base_config.sa_auth.dbsession = model.DBSession
base_config.sa_auth.user_class = model.User
# base_config.sa_auth.group_class = model.Group
# base_config.sa_auth.permission_class = model.Permission
base_config.sa_auth.translations.group_name = 'name'
base_config.sa_auth.translations.permission_name = 'name'
base_config.sa_auth.authmetadata = ApplicationAuthMetadata(base_config.sa_auth)
# base_config.sa_auth.authenticators = [('myauth', SomeAuthenticator()]
# base_config.sa_auth.mdproviders = [('myprovider', SomeMDProvider()]
base_config.sa_auth.form_plugin = None
base_config.sa_auth.charset = 'utf-8'
base_config.sa_auth.post_login_url = '/post_login'
base_config.sa_auth.post_logout_url = '/post_logout'
मुझे खेद है कि मैंने इसे पहले नहीं देखा था। अगर आपको अभी भी कुछ मदद चाहिए, तो मुझे यह कोशिश करने में खुशी होगी। क्या आप लॉगआउट अनुरोध और इसकी प्रतिक्रिया दोनों के लिए HTTP शीर्षलेख और निकाय दोनों को शामिल कर सकते हैं? –
इसके अलावा, यदि आप इसे चलाने वाले (गैर वर्चुअल) वातावरण में 'पाइप फ्रीज' के आउटपुट को शामिल कर सकते हैं तो यह सहायक होगा। –