如何替换cakephp密码哈希算法?

我有一个现有的数据库,我正试图把蛋糕应用程序放在上面.旧的应用程序在Perl中使用crypt()来散列密码.我需要在 PHP应用程序中执行相同的操作.

在标准的cakePHP应用程序中进行更改的正确位置在哪里?这样的改变会是什么样的?

我搞定了……

这是我的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');
    }
}

然后这是用户

<?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'],2));
         return $data;
    }
}
?>

我认为其他一切都很正常.

这是一个很好的资源:http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...