I created a function in a controller and its corresponding view (called 'feedback') for a page that does not require authentication and the URL looks like this:
http://[DOMAIN]/products/feedback/11351/6673/24678/2/rt6a513gr45255hrt563443h2463hd63
The URL works without requiring authentication and everything is perfect. This URL contains a form that the visitor needs to fill out and then this data goes straight to the database. The problem is that when the form is submitted, if the visitor has not logged in, then authentication is required and the process breaks there in a way that the data from the form is never sent to the database. What I want is for this URL not to require authentication, never, not when the page and form are loaded (this part already works fine) nor when the form is submitted (this is what I need to fix because when the submit button is clicked, authentication is immediately required).
UPDATE 1:
I already tried including the following code in `app/controllers/products_controller.php:
function beforeFilter(){
........................
........................
........................
parent::beforeFilter();
$this->Auth->allow('feedback');
}
My idea was to exclude the feedback
action from the authentication requirement. I tried this based on the documentation I found at https://book.cakephp.org/1.3/en/The-Manual/Core-Components/Authentication.html:
For example if we want to allow all users access to the index and view methods ( but not any other), we would do the following:
function beforeFilter() { $this->Auth->allow('index','view'); }
I found the same suggestion CakePHP Bypass Auth component to bypass Auth component in CakePHP.
this data goes straight to database
? Do you have action in cakephp that handles the form submit and it needs to skip auth check? – Alexthis data goes straight to the database
is that the visitor can initially visit the URL without requiring authentication and what I want is that the data filled out in the form can go directly to the database when when user clicks the submit button, without requiring authentication, meaning skipping auth check. – Jaime Montoyahttp://[DOMAIN]/products/feedback/11351/6673/24678/2/rt6a513gr45255hrt563443h2463hd63
URL, but after filling out the form correctly, I redirect the user to the home page. – Jaime Montoya$this->Auth->allow('feedback');
should certainly work. If you didn't have this previously, I was wondering how it was that you got the blank form to skip authentication. – Greg Schmidt