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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:06:45+00:00 2026-06-16T16:06:45+00:00

I have a strange issue going on as I try to learn and program

  • 0

I have a strange issue going on as I try to learn and program website using CakePHP 2.0. I have worked in the past with version 1.3 but never seen this problem before. I am running the Simple Authentication and Authorization Application tutorial from the Cookbook (p.638) and I have checked and doubled checked to make sure it is the same.

The issue I am having is that when I call /users/login and fill out the form with bogus info or simply leave it empty. Auth logs it in and if I do if($this->Auth->user()) I will receive true.

I have given up trying to understand why that is happening. It is strange….

/users/login

public function login(){
        if($this->request->is('post')){
            if($this->Auth->login($this->request->data)){
                $this->redirect($this->Auth->redirect());
            }else{
                $this->Session->setFlash('Wrong login credentials!', 'default', array('class' => 'notification error closeable')); 
            }
        }
}

// Appcontroller.php —- Auth configuration

class AppController extends Controller {

public $components = array(
    'Session',
    'Auth' => array(
        'authenticate' => array(
            'Form' => array(
                'fields' => array('username' => 'email')
            )
        ),
        'logoutRedirect' => array('controller' => 'pages', 'action' => 'home'),
        'authorize' => array('Controller')
    )
);

 public function isAuthorized($user){
    if(isset($user['role']) && $user['role'] === 'admin'){
        return true;
    }
    return false;
}
  • 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-16T16:06:46+00:00Added an answer on June 16, 2026 at 4:06 pm

    Ok.Seems like i know what the problem is. Try doing:

    if($this->Auth->login())
    

    instead of passing it CakeRequest object.

    The reason is:

    In 2.0 $this->Auth->login($this->request->data) will log the user in with whatever data is posted, whereas in 1.3 $this->Auth->login($this->data) would try to identify the user first and only log in when successful. Maybe thats why you are able to log in without any data.

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

Sidebar

Related Questions

I have a strange issue going on. It may be server related, but I
I have this strange issue going on with my CSS on my site, and
I'm having a strange issue that I've never encountered before. I have a partial
I have been going through this strange issue and have no clue what's going
I have a very strange issue going on here. It's only occurring on Internet
I have a strange issue using remoting with Powershell. I have a script called
I have a strange issue with a MVC 3 app running as an Azure
I have a strange issue . I am currently working on a mail app
i have a strange issue with phpexcel on a pair of formulas and can't
I have a strange issue: When I scroll vertically it triggers swipe right/left events.

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.