Skip to content

Schlaefer/cakephp-bcrypt-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Note: CakePHP 2.3+ supports bcrypt via its build in Security::hash function.


Simple Bcrypt Authenticator for Cake 2

Setup Auth configuration in controller:

	$this->Auth->authorize = array(
			'BcryptAuthenticate.Bcrypt',
	);

For validation in model if needed:

	App::uses('BcryptAuthenticate', 'BcryptAuthenticate.Controller/Component/Auth');

	class User extends AppModel {

		…

		protected function _checkPassword($password, $hash) {
			return BcryptAuthenticate::checkPassword($password, $hash);
		}

		protected function _hashPassword($password) {
			return BcryptAuthenticate::hash($password);
		}

	}

Don't forget to activate the plugin in your bootstrap.php if necessary.

About

Simple Bcrypt Authenticator for CakePHP 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages