0
私はログイン作業をしようとしています...しかし、私がmd5を持っていた(addを使って)登録すると、$ this-> Auth-> passwordに変更されました。その後、私はその行なしで試してみました..まあ、初めてログインしても問題ありませんでしたが、何らかの理由でログイン時に再びハッシュを変更してしまいました。データベースを修正する方法はわかりません。パスワードハッシングが正しく動作しない
<?php
class UsersController extends AppController {
var $uses = array("User");
var $components = array('Auth', 'Session');
function index()
{
$this->set('users', $this->User->find('all'));
$this->layout = 'master_layout';
}
function beforeFilter() {
$this->Auth->allow('add');
}
function add() {
if (!empty($this->data)) {
//pass is hashed already
//->data['User']['password'] = $this->Auth->password($this->data['User']['password']);
if ($this->User->save($this->data)) {
$this->Session->setFlash('Your were registered!.');
$this->redirect(array('action' => 'index'));
}
}
$this->layout = 'master_layout';
}
//IF THE DATABASE IS SET UP CORRECTLY CAKE AUTHENTICATES AUTOMATICALLY NO
//LOGIC IS NEEDED FOR LOGIN http://book.cakephp.org/view/1250/Authentication
function login() {
$this->layout = 'master_layout';
}
function logout() {
$this->redirect($this->Auth->logout());
}
}
?>
VIEW
<?php
echo $this->Session->flash('auth');
echo $this->Form->create('User');
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->end('Login');
?>
を参照してください.... – ThiefMaster
あなたは何を意味するのですか? – mark
これは前にuser_passwordを持っていました。 – user710502