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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:03:14+00:00 2026-06-04T08:03:14+00:00

I started trying out CakePHP a few months ago and I’m now attempting to

  • 0

I started trying out CakePHP a few months ago and I’m now attempting to create a “change password page” for logged in users. I have a form consisting of these fields: current password, new password and new password confirmation. For the current password, I want to validate that it matches the password of the logged in user, as a rule within the user Model. I know that I can get information of the logged in user with this: AuthComponent::user(). However, it provides me every field of the model except the password.

I know that Auth->login() is responsible for setting the session variables for the logged in user, but I’m not sure what I’m doing wrong here that only the password field cannot be accessed:

public function login() {

    if ($this->request->is('POST')) {
        if($this->Auth->login()) {
            $this->redirect($this->Auth->redirect());
        } else {
            $this->Session->setFlash('Your username/password combination was incorrect.');
        }
    }
}

Here’s my login view:

<h2>Login</h2>
<?php 
echo $this->Form->create('Promoter');
echo $this->Form->input('username');
echo $this->Form->input('password', array('type' => 'password'));
echo $this->Form->end('Login');?>

I’m using the Promoter model as the user, which i set in the AppController:

public $components = array(
    'Auth'=>array(
        ...
        'authenticate' => array(
            'Form' => array('userModel' => 'Promoter')
        ),
        'authorize' => array('Controller')
    )
);

I can resort to validating the password in the Controller, but that would be giving up 🙂 Please tell me if I need to provide more code to clarify the issue.

Thanks.

  • 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-04T08:03:15+00:00Added an answer on June 4, 2026 at 8:03 am

    You’re probably not doing anything wrong, this is most likely a security feature. There is no reason to keep a password in your session.

    Secondly, even if it was in session, it would be encrypted (or at least I hope so, if it’s not you should change that immediately!). So you still couldn’t do a simple comparison.

    To compare the old password, you should query your Promoter model, and get the hashed password from there, then hash the old password from your “change password” form, and finally compare the hashed results.

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

Sidebar

Related Questions

I've been trying out MVC 4 lately. Started with the developer preview, and now
We've just started trying out gStreamer-Sharp, to see if we can create pipelines, with
I am just getting started with SVG and am now trying out rotating objects.
I started out trying to add meta tags in the <head> tags but now
I'm trying out MVVM in VB.Net for a while now and started out with
I am just getting started with JS Unit Testing and am trying out qUnit.
I'm trying to get started with Scala and cannot get out of the starting
I'm trying to get started with Django, and have previously worked with CakePHP, and
I have started learning Ruby recently and I was trying out the following piece
i just started learning swings. And thought of trying out a simple program, but

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.