I am having a problem that I can not figure out. I am working on a website that requires login. I first got the site running with the Auth part in AppController commented out, as well at the login function in my UsersController. Once I got the some of the basic stuff working, I removed all the comments in the controllers and tried to get it to work with the Auth Component enabled, but I am getting an error saying there are to many redirects. I got this working before, but I forgot what I did. I am thinking I adjusted the number of redirects allowed in some configuration file, but I am not sure. Any help would be greatly appreciated.
From what I understand, you are saying to put the function above into my users controller as that contains my login action. If that is where it should go, I placed it in the users controller, and received this message: Argument 1 passed to App\Controller\UsersController::beforeFilter() must be an instance of App\Controller\Event, instance of Cake\Event\Event given, called in D:\cen\vendor\cakephp\cakephp\src\Event\EventManager.php on line 414.
I am not sure what that means, but I will keep searching. If I was wrong or there are any other suggestions please let me know.
What this before Filter is doing, It is doing a check before any action is taken. This is where you will define which Controller’s Action access is allowed without authorization.