Skip to content

Commit

Permalink
Fix namespace and use statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 26, 2013
1 parent 79dff5b commit 3c8db23
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/Controller/Component/Auth/BlowfishPasswordHasher.php
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/Controller/Component/Auth/SimplePasswordHasher.php
Expand Up @@ -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.
Expand Down
Expand Up @@ -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';
Expand Down
Expand Up @@ -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'
Expand Down

0 comments on commit 3c8db23

Please sign in to comment.