[Erp5-report] r25398 - /erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 30 18:47:15 CET 2009


Author: ivan
Date: Fri Jan 30 18:47:15 2009
New Revision: 25398

URL: http://svn.erp5.org?rev=25398&view=rev
Log:
Detect if credentials changed and renew _ac cookie.

Modified:
    erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py

Modified: erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py?rev=25398&r1=25397&r2=25398&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py [utf8] Fri Jan 30 18:47:15 2009
@@ -50,6 +50,7 @@
 
 # global (RAM) cookie storage
 cookiejar = cookielib.CookieJar()
+last_loggedin_user_and_password = None
 referer  = None
 installation_status = {'bt5': {'current': 0,
                                'all': 0,},
@@ -267,7 +268,7 @@
   security.declareProtected(Permissions.View, 'proxy')
   def proxy(self, **kw):
     """Proxy a request to a server."""
-    global cookiejar, referer
+    global cookiejar, referer, last_loggedin_user_and_password
     if self.REQUEST['REQUEST_METHOD'] != 'GET':
       # XXX this depends on the internal of HTTPRequest.
       pos = self.REQUEST.stdin.tell()
@@ -315,6 +316,9 @@
     user_and_password = self._getSubsribedUserAndPassword()
     if (len(user_and_password)==2 and
         user_and_password[0] and user_and_password[1]):
+      if user_and_password!=last_loggedin_user_and_password:
+        # credentials changed we need to renew __ac cookie from server as well
+	cookiejar = cookielib.CookieJar() 
       # try login to server only once using cookie method
       if not _isUserAcknowledged(cookiejar):
         server_url = self.getServerUrl()
@@ -327,7 +331,8 @@
         if not _isUserAcknowledged(cookiejar):
           auth = 'Basic %s' % base64.standard_b64encode('%s:%s' % user_and_password)
           header_dict['Authorization'] = auth
-
+        # save last credentials we passed to server
+	last_loggedin_user_and_password = user_and_password
     if content_type:
       header_dict['Content-Type'] = content_type
 




More information about the Erp5-report mailing list