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

  • SEARCH
  • Home
  • 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 6996335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:08:35+00:00 2026-05-27T20:08:35+00:00

Just starting to learn the CakePHP framework. I’m using the Auth component, and all

  • 0

Just starting to learn the CakePHP framework. I’m using the Auth component, and all my actions that require a user to be logged in redirect to users/login rather than login/login (my non-standard controller). Anyone know where I can change this setting? Also, how does the auth component work across multiple controllers? Will I have to redefine this auto-redirect in every controller?

  <?php
  class LoginController extends AppController {

    public $name = 'Login';

    public $components = array('Auth');

    public $helpers = array('Html', 'Form' );

    function beforeFilter() {
            // tell Auth not to check authentication when doing the 'register' action
            $this->Auth->allow('register');
            $this->Auth->userModel = 'Login';
    }

    function register() {
            if (!empty($this->data)){
                    if ($this->Login->save($this->params['data'])) {
                            $this->flash('Your registration information was accepted. Welcome!');
                            $this->Auth->login($this->data);
                            $this->redirect(array('action' => 'index'));
                    } else {
                            $this->flash('There was a problem with your registration', '/login/knownusers');
                     }
             }      

    }

    function createprofile() {



    }

    function knownusers() {
            $this->set('knownusers', $this->Login->find(
                    'all',
                    array(
                             'fields' => array('id','username', 'password', 'fk_profile_id'),


                            $this->redirect(array('action' => 'index'));
                    } else {
                            $this->flash('There was a problem with your registration', '/login/knownusers');
                     }
             }      

    }

    function createprofile() {



    }

    function knownusers() {
            $this->set('knownusers', $this->Login->find(
                    'all',
                    array(
                             'fields' => array('id','username', 'password', 'fk_profile_id'),
                            'order' => 'id DESC'  
                    )
            ));
    }       

    function login() {
    }

    function logout() {
            $this->redirect($this->Auth->logout('login/login'));
    }

 }
 ?>
  • 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-05-27T20:08:36+00:00Added an answer on May 27, 2026 at 8:08 pm

    If your entire website needs to be protected, then you can define the Auth component in your AppController which will cause those rules to apply to every controller that inherits from that object (i.e. all controllers on your site).

    The CakePHP Authentication Documentation outlines all the parameters you need in order to accomplish what you are trying to do. You should be able to define the login redirect when you setup the Auth component:

    public $components = array(
        'Auth' => array(
            'loginAction' => array('controller' => 'User', 'action' => 'login')
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting to learn ASP.NET (C#) and I am using Visual Studio 2008. I
I'm just starting to learn AspectJ, and I have use-case for say, User login.
I was just starting to learn cakephp today by going through a blog tutorial.
I am just starting to learn a bit about the entity framework and don't
I'm just starting to learn the .NET Micro Framework, and coming from C# I
A friend is just starting to learn Java, using IntelliJ. He asks how can
I am just starting to learn Pyramid Framework . Is pyramid_who (repoze.who) the preferred
I am just starting to learn CakePHP, I have downloaded version 1.3.7. i noticed
Go easy, I'm just starting to learn CakePHP. I'm having to ask this question
Just starting to learn Ruby on Rails. I'm using RoR 3. I have read

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.