Sadece CakePHP 2.4.1 Bu takip, ben md5 olarak depolanan kullanıcı şifreleri mevcut olan eski bir veritabanı için bir ön uç bina edilmiştir (: StaticText: hesap_numarası şifre) ve kullanıcılar, biz bu karma kullanmak için gereken giriş için izin sistem de.
Çözüm oldu:
Bir dosya uygulaması oluşturun / Controller / Komponent / Auth / CustomAuthenticate.php ile:
<?php
App::uses('FormAuthenticate', 'Controller/Component/Auth');
class CustomAuthenticate extends FormAuthenticate {
    protected function _findUser($username, $password = null) {
        $userModel = $this->settings['userModel'];
        list(, $model) = pluginSplit($userModel);
        $fields = $this->settings['fields'];
        if (is_array($username)) {
            $conditions = $username;
        } else {
            $conditions = array(
                $model . '.' . $fields['username'] => $username
            );
        }
        if (!empty($this->settings['scope'])) {
            $conditions = array_merge($conditions, $this->settings['scope']);
        }
        $result = ClassRegistry::init($userModel)->find('first', array(
            'conditions' => $conditions,
            'recursive' => $this->settings['recursive'],
            'contain' => $this->settings['contain'],
        ));
        if (empty($result[$model])) {
            return false;
        }
        $user = $result[$model];
        if ($password) {
            if (!(md5($username.":statictext:".$password) === $user[$fields['password']])) {
                return false;
            }
            unset($user[$fields['password']]);
        }
        unset($result[$model]);
        return array_merge($user, $result);
    }
}
Bu dosya _findUser işlevi devraldı ancak normal olarak tüm diğer işlevler için FormAuthenticate defers anlamına gelen "FormAuthenticate uzanır". Bu daha sonra AppController.php düzenleme ve bu gibi AppController sınıfı şey ekleyerek aktive edilir:
public $components = array(
    'Session',
    'Auth' => array(
        'loginAction' => array('controller' => 'accounts', 'action' => 'login'),
        'loginRedirect' => array('controller' => 'accounts', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'),
        'authenticate' => array (
            'Custom' => array(
                'userModel' => 'Account',
                'fields' => array('username' => 'number'),
            )
        ),
    )
);
Özellikle ilişkisel dizi anahtarın 'Özel' kullanımını unutmayın.
Son olarak yeni bir kullanıcı oluştururken böylece modeli dosyasına, parola karma için gerekli (benim durumumda account.php de) Ben ekledi:
public function beforeSave($options = array()) {
    if (isset($this->data[$this->alias]['password'])) {
        $this->data[$this->alias]['password'] = md5($this->data[$this->alias]['number'].":statictext:".$this->data[$this->alias]['password']);
    }
    return true;
}