From: <plo...@us...> - 2003-07-08 23:37:28
|
Update of /cvsroot/plone/CMFPlone/skins/plone_forms In directory sc8-pr-cvs1:/tmp/cvs-serv16377/skins/plone_forms Modified Files: Tag: Plone-1_0 logged_in.py login_failed.pt Log Message: Modified cookie testing code in logins to (hopefully) fix problems with IE 5.0. Index: logged_in.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/skins/plone_forms/logged_in.py,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -C2 -d -r1.2.2.4 -r1.2.2.5 *** logged_in.py 10 Apr 2003 20:55:00 -0000 1.2.2.4 --- logged_in.py 8 Jul 2003 23:37:25 -0000 1.2.2.5 *************** *** 17,36 **** # If you log in with cookies disabled, you will appear to be logged ! # in when you hit login.py. To make sure you are really logged in, ! # we force the page to reload and then test for login status. # - # Look for the REQUEST variable 'success' -- if it's not present, - # redirect to the current page. - success = REQUEST.get('success',None) - if success is None: - # 'success' variable not found -- create it and reload the page - args = REQUEST.form - args['success'] = not isAnonymous - url = '%s?%s' % (REQUEST.URL, ZTUtils.make_query(args)) - # make sure the redirect header we are about to send isn't cached! - REQUEST.RESPONSE.setHeader('Expires', 'Sat, 1 Jan 2000 00:00:00 GMT') - REQUEST.RESPONSE.setHeader('Pragma', 'no-cache') - return REQUEST.RESPONSE.redirect(url) login_failed = 'login_failed' login_changepassword = 'login_password' --- 17,36 ---- # If you log in with cookies disabled, you will appear to be logged ! # in when you hit login.py. To see if a login failure is due to ! # cookies being disabled, we test a session cookie that is set by main_template. ! # This isn't foolproof, but it should catch most cases. ! # ********************************************************************* ! # To enable this testing, you need to set the variable test_cookie in * ! # site_properties to a non-empty value. * ! # ********************************************************************* # + no_cookies = 0 + test_cookie_name = getattr(properties_tool, 'test_cookie_name', None) + if test_cookie_name: + test_cookie = REQUEST.cookies.get(test_cookie_name, None) + if test_cookie is None: + no_cookies = 1 + login_failed = 'login_failed' login_changepassword = 'login_password' *************** *** 38,43 **** pagetemplate=None ! if isAnonymous: REQUEST.RESPONSE.expireCookie('__ac', path='/') return context.restrictedTraverse(login_failed)() --- 38,44 ---- pagetemplate=None ! if isAnonymous or no_cookies: REQUEST.RESPONSE.expireCookie('__ac', path='/') + REQUEST.set('no_cookies', no_cookies) return context.restrictedTraverse(login_failed)() Index: login_failed.pt =================================================================== RCS file: /cvsroot/plone/CMFPlone/skins/plone_forms/login_failed.pt,v retrieving revision 1.2.2.5 retrieving revision 1.2.2.6 diff -C2 -d -r1.2.2.5 -r1.2.2.6 *** login_failed.pt 11 Apr 2003 06:36:47 -0000 1.2.2.5 --- login_failed.pt 8 Jul 2003 23:37:25 -0000 1.2.2.6 *************** *** 18,26 **** <div metal:fill-slot="main"> ! ! <div tal:define="p_props here/portal_properties; success request/success|nothing;"> ! <div tal:condition="not:success"> <h1 i18n:translate="heading_sign_in_failure">Sign-in failure</h1> --- 18,26 ---- <div metal:fill-slot="main"> ! <div tal:define="p_props here/portal_properties; success request/success|nothing;"> ! ! <div tal:condition="not:request/no_cookies|nothing"> <h1 i18n:translate="heading_sign_in_failure">Sign-in failure</h1> *************** *** 37,46 **** </p> </div> ! <div tal:condition="success"> <h1 i18n:translate="heading_sign_in_failure">Cookies must be enabled</h1> <p>You are not currently signed in because you are not accepting cookies. Please make sure that your browser is configured to ! <a href="enabling_cookies">accept cookies</a>. <p>If you are still reaching this page after correctly configuring --- 37,48 ---- </p> </div> ! <div tal:condition="request/no_cookies|nothing"> <h1 i18n:translate="heading_sign_in_failure">Cookies must be enabled</h1> <p>You are not currently signed in because you are not accepting cookies. Please make sure that your browser is configured to ! <a href="enabling_cookies">accept cookies</a>. After you have enabled ! cookies, press your browser's reload button on any page in the site and ! then log in again.</p> <p>If you are still reaching this page after correctly configuring |