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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:22:51+00:00 2026-05-26T21:22:51+00:00

Using CakePHP2.0 Beta I managed to write a custom login handler for my existing

  • 0

Using CakePHP2.0 Beta I managed to write a custom login handler for my existing database schema. All’s well, except that upon logging in I printed out the session variables stored and what Cake’s Auth component did is store the entire record from the “Member” table (where my usernames+hashes come from) in session. It is storing an array with data fields that are totally irrelevant to the session. For instance it stores the date the member was created, their address, etc. All pretty useless information for me as I basically only need their ID and maybe username, name, email address.

The offending lines for me are found in: /lib/Cake/Controller/Component/AuthComponent.php line 512. It states,

$this->Session->write(self::$sessionKey, $user);

So my custom authenticate component returns $user and it throws this whole thing into the session. Now, I don’t want to go about editing in the core libraries because this project is definitely going to be upgraded when 2.0 comes out. Is there any way to store less information in sessions? I want to keep this whole thing more lightweight.

Possible solution: Change my custom authentication component to only return the fields I need into the $user variable. Are there any concerns about what data I should/shouldn’t be returning?

  • 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-26T21:22:52+00:00Added an answer on May 26, 2026 at 9:22 pm

    I’ve solved the problem using my “possible solution”. In /app/Controller/Component/auth/MyController.php, I changed the “ClassRegistry::init($userModel)->find” method to have a parameter for ‘fields’ where I specify only the fields I need. Works like a charm.

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

Sidebar

Related Questions

I am using cakephp framework to build my application. I want that, whenever a
I am using CakePHP framework with MySQL database and I have problem in saving
After I uploaded my application created using cakephp, I found out that I had
Using CakePHP, I am finding that I'm duplicating some code between controller actions. I
I'm Using CakePHPs standard Auth mechanism, but I have some problems with that. Everytime
I'm using cakePHP 1.2, and wondering how I can handle a URL that dynamically
Using CakePHP 1.3 I'm trying to save some data to a MySQL database. The
I am using CakePHP 1.3 to write a application, and I create a datetime
Using CakePHP 1.3, is there is a callback that is fired after a saveAll()
i am using cakephp facebook plugin. when i click login. i get the following

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.