CakePHP has no built-in method to prevent the form from repeating, how to resolve
Source: Internet
Author: User
There are no built-in methods in cakephp to prevent forms from repeating commits
If I do a user registration function, point to submit to the information confirmation page, point submission, warehousing (not to do information in the storage of the verification such as: whether the user name is already present, when entering the information confirmation page, will do the corresponding check).
After I completed the storage, the Point browser Back button will be returned to the information confirmation page, when the click on the submission, because there is no verification, the user's information will be repeated storage.
I just want to ask cakephp built-in methods. Like token validation These methods I know.
Because of the contact cake not long. Want to know can be specific to say.
------Solution--------------------
Look at http://www.ibm.com/developerworks/cn/opensource/os-php-cake3/.
It says here.
Talking about caching
While there are obvious advantages to using the Requireauth protection operation, there are some drawbacks that need to be overcome. Most of the drawbacks are "cache issues."
The validation key is generated whenever the form is Requireauth evaluated. This means that if a user submits a form that contains a used key, the form submission action is considered invalid. This problem occurs in several situations, including (but not limited to) using multiple browser windows, using the Back button to return to the previous page, browser caching, proxy server caching, and so on. You may think of these issues as user errors and therefore ignore them; you should resist temptation and proceed with invalid form submissions.
If you use security, when submitting a form, CakePHP automatically verifies the token and session in the form, and you can unset the token value in the session after you have put it into storage. No matter how the user returns to the confirmation page, at the time of submission, CakePHP will check, the check will be rolled back, you can write a rollback method, to prompt.
If the core code is clear, you will understand the process.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.