I'm trying to set up bcrypt for my cakephp app. I've set it up before, on another app, and that worked. But, after basically copy / pasting the encryption code from one app to the other, it's saving the password as blank.
The database is setup correctly with the password field being a varchar(225).
I've come to the conclusion that the following line of code is what's causing the problem;
public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$hash = Security::hash($this->data['User']['password'], 'blowfish');
$this->data['User']['password'] = $hash;
}
return true;
}
If I were to take out this beforeSave function, my password would save correctly, as plaintext. If I were to replace
$this->data['User']['password'] = $hash;
with
$this->data['User']['password'] = 'testpassword';
It would correctly save the password as testpassword.
My AppController:
public $components = array(
'Session',
'Auth' => array(
'authenticate' =>'Blowfish',
'logoutRedirect' => array('controller'=>'fronts', 'action'=>'index'),
'authorize' => array('Controller')
)
);
My Form:
<?php echo $this->Session->flash('auth'); ?>
<?php echo $this->Form->create('User'); ?>
<fieldset>
<?php
echo $this->form->input('username', array('placeholder' => 'Username', 'label' => false));
echo $this->form->input('password', array('placeholder' => 'Password', 'label' => false));
echo $this->form->submit('CREATE', array('class' => 'button'));
?>
</fieldset>
<?php echo $this->Form->end(); ?>
When trying to login, though I know it won't work, I get this error
Authentication adapter Blowfish was not found.