Item6012: POST data lost without previous login (query cache mechanism not 100%)
Priority: Urgent
Current State: Closed
Released In: 1.0.0
Target Release: patch
Applies To: Engine
Component: TWiki::UI
Branches:
Using a fresh twiki svn checkout (I didn't test yet with TWikiRelease04x02):
- Go to Sandbox.WebHome and change method definition of the form used to create new topics given a name: (original form doesn't have
method
attr, so it defaults to get
)
<form method="post" action='%SCRIPTURLPATH{"search"}%/%WEB%/'>
- Logout
- Try to create a topic named 'TestTopic', for example
- TWiki should ask you to login (I tested this issue with TemplateLogin)
- You'll WYSIWYG editing Sandbox.WebHome, instead of TestTopic
It happens because it's necessary to be logged in to create a topic, so original POSTed data is cached and TWiki redirects you to login with
twiki_redirect_cache
URLPARAM adjusted, so original data can be loaded (and if you look at hidden field, all original POSTed data is there, including
twiki_redirtect_cache
). Then you POST login info and TemplateLogin, after validation, redirects you to
origurl
asking for a cache (
TWiki::LoginManager::TemplateLogin::login()
calls
TWiki->redirect($origurl, 1)
).
TWiki::redirect
calls
TWiki::cacheQuery
and this one returns empty string, since we already have a
twiki_redirect_cache
. Here comes the problem: the current
twiki_redirect_cahce
was defined at the first POST (the one that resulted on login screen) and was used (and erased!
TWiki::UI
unlinks cache file after read) and orignal data is lost.
The solution is quite simple:
TWiki::UI
should
delete twiki_redirect_cache
parameter after unlink (at this stage, it's not valid anymore). This way, if another cache is needed, then a new file is created and things works well.
--
TWiki:Main/GilmarSantosJr - 22 Sep 2008
I've just tested TWkiRelease04x02: it's ok. No changes needed.
--
TWiki:Main.GilmarSantosJr - 22 Sep 2008