Shaarli
Shaarli copied to clipboard
Do not lose POST data when token expires ("Wrong token")
I just tried to post a link with a lengthy description, and it took me some time to write it, plus I did a few other things in-between. When I wanted to save the link, I got a "Wrong token" error. Fair enough, but all my data was lost!
So, please do not lose the POST data (at least not lf_url
, lf_title
and lf_description
). Ideally the form would be re-shown with only a (big) warning on top, so all it would require would be to re-hit save in such a case.
Alternatively if the submission was done through XHR you could just not close the form on error, which at least would allow the user to backup his data and retry.
If this happens to anyone else in the meantime and you didn't close the page, you can quickly hack to recover your data: just edit shaarli's index.php and add var_dump($_POST);
at the very end, just before renderPage();
. Then, force your browser to re-submit the page (e.g. just reload it with Firefox, it will ask whether to resubmit, and you say yes): it will still not save your data but you will be able to back it up (check out the page's source so you also have proper newlines).
Don't forget to remove the added line when you backed up your data!
Hi @b4n, this repository is currently unmaintained (@sebsauvage does not have much time for Shaarli currently). We have set up a community fork at https://github.com/shaarli/shaarli which you can check out for bug fixes and features, up to date/maintained bug tracker, documentation, etc.
Unfortunately we will not add this on the short term, unless you can suggest a very simple implementation. This would require a large rewrite of how the POST system works. Saving form data should be handled by your browser ((addons such as this one). You can check "stay signed in" at login to prevent your session from expiring.
Again, feel free to report on the shaarli/Shaarli bug tracker if you can propose a simple implementation.