Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:37:06+00:00 2026-06-03T13:37:06+00:00

I am following the CakePHP ACL tutorial http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html I have a controller called ImagesController

  • 0

I am following the CakePHP ACL tutorial
http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html

I have a controller called ImagesController that basically lets the user list all the images that have been uploaded. There are also actions such as “upload” and “delete” images.

I also have a UserController that has login and logout function.

My AppController.php looks like this

  1 <?php
  2 
  3 class AppController extends Controller {
  4     public $components = array(
  5             'Acl',
  6             'Auth' => array(
  7                 'authorize' => array(
  8                     'Actions' => array('actionPath' => 'controllers')
  9                     )
 10                 ),
 11             'Session'
 12             );
 13     public $helpers = array('Html', 'Form', 'Session');
 14 
 15     public function beforeFilter() {
 16  //       $this->Auth->actionPath = 'controllers/';
 17         //Configure AuthComponent
 18         $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
 19         $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
 20         $this->Auth->loginRedirect = array('controller' => 'images', 'action' => 'index');
 21         $this->Auth->allow('display');
 22  //       $this->Auth->allow('*');
 23     }
 24 }
 25 
 26 
 27 ?>
~             

My UsersController.php looks like this

<?php
  2 App::uses('AppController', 'Controller');
  3 /**
  4  * Users Controller
  5  *
  6  * @property User $User
  7  */
  8 class UsersController extends AppController {
 30     public function beforeFilter() {
 31         parent::beforeFilter();
 32         //$this->Auth->allow("initDB"); // remove this later
 33         $this->Auth->allow('login', 'logout');
 34     }
 35     public function login() {
 36         if ($this->Session->read('Auth.User')) {
 37             $this->Session->setFlash('You are logged in!');
 38             $this->redirect('/', null, false);
 39         }
 40     }
 41     public function logout() {
 42         //Leave empty for now.
 43         $this->Session->setFlash('Good-Bye');
 44         $this->redirect($this->Auth->logout());
 45     }
}

So now when I click on an action in images/index such as upload or delete, it sends me to user/login page but when I try to log in nothing happens, even though I have my redirect pointed to images/index in line 20. What gives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:37:07+00:00Added an answer on June 3, 2026 at 1:37 pm

    Unlike Cake 1.3, in Cake 2, the login is not done automatically. This means you have to call $this->Auth->login() explicitely.

    Have a look at the login() action in the tutorial. So far, you never perform the login, and that explains why you are not redirected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following the http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html tutorial and I am at the part where you
I'm new to cakephp and following this tutorial. http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html I have created the blog
We started following the CakePHP Blog tutorial hosted on the website cakephp.org - http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html
I've been following this tutorial http://book.cakephp.org/2.0/en/development/rest.html for restful web services integration with cakephp over
I am following this tutorial http://book.cakephp.org/2.0/en/development/rest.html to get up and running with REST in
I'm new to cakephp and following this tutorial for a user authentication system http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-x-x
I'm following the Auth tutorial and in this stage http://book.cakephp.org/view/1547/Acts-As-a-Requester aros table is not
I'm generating plain simple links with CakePHP's HtmlHelper the following way: $html->link(Newest, array( 'controller'
While following the instructions on the CakePHP book to create an ACL controlled site
I'm using the following tutorial to build a password reset form: http://bakery.cakephp.org/articles/eimermusic/2007/10/23/ticket-component-resetting-user-passwords However when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.