Skip to content
Permalink
Browse files

Fix namespace and use statements.

  • Loading branch information...
ADmad committed May 26, 2013
1 parent 79dff5b commit 3c8db2377424da323d9f1f3b683a03e30bafc31e
@@ -13,6 +13,7 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Controller\Component\Auth;
/**
* Abstract password hashing class
@@ -16,6 +16,7 @@
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Error;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Utility\ClassRegistry;
@@ -137,7 +138,7 @@ protected function _findUser($username, $password = null) {
* Return password hasher object
*
* @return AbstractPasswordHasher Password hasher instance
* @throws CakeException If password hasher class not found or
* @throws Cake\Error\Exception If password hasher class not found or
* it does not extend AbstractPasswordHasher
*/
public function passwordHasher() {
@@ -154,13 +155,12 @@ public function passwordHasher() {
unset($config['className']);
}
list($plugin, $class) = pluginSplit($class, true);
$className = $class . 'PasswordHasher';
App::uses($className, $plugin . 'Controller/Component/Auth');
$className = App::classname($class, 'Controller/Component/Auth', 'PasswordHasher');
if (!class_exists($className)) {
throw new CakeException(__d('cake_dev', 'Password hasher class "%s" was not found.', $class));
throw new Error\Exception(__d('cake_dev', 'Password hasher class "%s" was not found.', $class));
}
if (!is_subclass_of($className, 'AbstractPasswordHasher')) {
throw new CakeException(__d('cake_dev', 'Password hasher must extend AbstractPasswordHasher class.'));
throw new Error\Exception(__d('cake_dev', 'Password hasher must extend AbstractPasswordHasher class.'));
}
$this->_passwordHasher = new $className($config);
return $this->_passwordHasher;
@@ -13,8 +13,10 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('AbstractPasswordHasher', 'Controller/Component/Auth');
App::uses('Security', 'Utility');
namespace Cake\Controller\Component\Auth;
use Cake\Controller\Component\Auth\AbstractPasswordHasher;
use Cake\Utility\Security;
/**
* Blowfish password hashing class.
@@ -13,8 +13,10 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('AbstractPasswordHasher', 'Controller/Component/Auth');
App::uses('Security', 'Utility');
namespace Cake\Controller\Component\Auth;
use Cake\Controller\Component\Auth\AbstractPasswordHasher;
use Cake\Utility\Security;
/**
* Simple password hashing class.
@@ -198,8 +198,8 @@ public function testAuthenticateWithBlowfish() {
$hash = Security::hash('password', 'blowfish');
$this->skipIf(strpos($hash, '$2a$') === false, 'Skipping blowfish tests as hashing is not working');
$request = new CakeRequest('posts/index', false);
$request->addParams(array('pass' => array(), 'named' => array()));
$request = new Request('posts/index');
$request->addParams(array('pass' => array()));
$_SERVER['PHP_AUTH_USER'] = 'mariano';
$_SERVER['PHP_AUTH_PW'] = 'password';
@@ -255,7 +255,7 @@ public function testPasswordHasherSettings() {
array('User.user' => 'mariano')
);
$request = new CakeRequest('posts/index', false);
$request = new Request('posts/index');
$request->data = array('User' => array(
'user' => 'mariano',
'password' => 'mypass'

0 comments on commit 3c8db23

Please sign in to comment.
You can’t perform that action at this time.