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 8792741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:01:19+00:00 2026-06-13T23:01:19+00:00

I am using cakephp 2.1 and I used login action in UsersController as follows.

  • 0

I am using cakephp 2.1 and I used login action in UsersController as follows.

public function login() {
    if ($this->request->is('post')) {
        if ($this->Auth->login()) {
            $this->redirect($this->Auth->redirect());
        } else {
            $this->Session->setFlash('Invalid email or password, try again', 'default/flash_error');
        }
    }
}

And the login.ctp code is as follows.

<?php echo $this->Form->create('User', array('class' => 'form')); ?>

            <div class="control-group">
                <label class="control-label" for="inputEmail">Email</label>
                <div class="controls">
                    <?php echo $this -> Form -> text('email', array('id' => 'inputEmail', 'placeholder' => 'Email')); ?>
                    <?php echo $this -> Form -> error('email', null, array('wrap' => 'span', 'class' => 'help-block')); ?>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="inputPassword">Password</label>
                <div class="controls">
                    <?php echo $this -> Form -> password('password', array('id' => 'inputPassword', 'placeholder' => 'Password')); ?>
                    <?php echo $this -> Form -> error('password', null, array('wrap' => 'span', 'class' => 'help-block')); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <label class="checkbox">
                        <input type="checkbox"/>
                        Remember me </label>
                    <?php echo $this->Form->button('Sign in', array('type' => 'submit', 'class' => 'btn')); ?>
                </div>
            </div>
            <?php echo $this->Form->end(); ?>

When the form get submitted with email and password, the user is not able to login so its showing an error ‘Invalid email or password, try again’. Even I am passing the $this->request->data[‘User’] into $this->Auth->login() method and debugged $this->Session->read(Auth.User.id). Its giving me null. Please give me a solution for this.

  • 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-13T23:01:20+00:00Added an answer on June 13, 2026 at 11:01 pm

    You can try passing $this->request->data into the $this->Auth->login() method. It’s not a great way to do it (see this post: CakePHP Auth Component Not logging in when using $this->Auth->login();), but it works for me. Have you debugged $this->Auth->login()?

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

Sidebar

Related Questions

I am using cakephp auth Plugin . After login what happening is . The
I have used cakePHP 1.2 and know how to use behaviors in it. using
I am using CakePHP 2.1 and I am having this tag in my program..
In cakephp, I used $rNo array in WHERE clause. $rooms =$this->find('all',array( 'conditions'=>array(NOT=>array('Room.id'=>$rNo)), 'group'=>array('Room.room_type_id'))); Now,
I have project developed using cakephp 1.3 and for testing I used SQL Inject
I've just started using cakephp elements and they're awesome (I used to use include).
Iam using cakephp ajax link for calling a page <div id=post> </div> <?php echo
This is a multi part question. Background: I'm building my first site using CakePHP,
I am using this LinkedIn plugins for CakePHP 2.0.4: https://github.com/ProLoser/CakePHP-LinkedIn I setup everything to
Im using cakephp 2.0 and i have data submitted that i want to cleanup,

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.