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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:52:05+00:00 2026-05-11T07:52:05+00:00

I have an existing database I’m trying to put a cake app on top

  • 0

I have an existing database I’m trying to put a cake app on top of. The old app used crypt() in Perl to hash the passwords. I need to do the same in the PHP app.

Where is the correct place to make that change in a standard cakephp app? And what would such a change look like?

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T07:52:05+00:00Added an answer on May 11, 2026 at 7:52 am

    I got it working…

    here is my AppController:

    class AppController extends Controller {     var $components = array('Auth');      function beforeFilter() {         // this is part of cake that serves up static pages, it should be authorized by default         $this->Auth->allow('display');         // tell cake to look on the user model itself for the password hashing function         $this->Auth->authenticate = ClassRegistry::init('User');         // tell cake where our credentials are on the User entity         $this->Auth->fields = array(            'username' => 'user',            'password' => 'pass',         );         // this is where we want to go after a login... we'll want to make this dynamic at some point         $this->Auth->loginRedirect = array('controller'=>'users', 'action'=>'index');     } } 

    Then here is the user:

    <?php class User extends AppModel {     var $name = 'User';      // this is used by the auth component to turn the password into its hash before comparing with the DB     function hashPasswords($data) {          $data['User']['pass'] = crypt($data['User']['pass'], substr($data['User']['user'], 0, 2));          return $data;     } } ?> 

    Everything else is normal, i think.

    Here is a good resource: http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/

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

Sidebar

Related Questions

I have existing database and ADO Data services on top of it. Right now
So I have an existing database that I'm trying to manipulate through ActiveRecord. All
I have an existing database. At the moment I am trying to map my
I have existing oracle database. I want to put it under source control (Subversion).
I have an existing database(myDatabse) that I created with Microsoft Sql Managenent studio and
I have an existing database containing some pictures in blob fields. For a web
I have an existing database with tables which each have 4 partitions (there are
I have an existing database with users and administrators in different tables. I am
I have an existing database in mysql. One of my tables has discontinuous ids.
I have an existing database based on SQLiteOpenHelper that has several versions and code

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.