Skip to content
Permalink
Browse files

Move Security.salt value check to WeakPasswordHasher.

  • Loading branch information...
ADmad committed Aug 28, 2014
1 parent 7cda879 commit c3038f7571840f0374bf8ddfd701088b98de776a
@@ -15,6 +15,8 @@
namespace Cake\Auth;
use Cake\Auth\AbstractPasswordHasher;
use Cake\Core\Configure;
use Cake\Utility\Debugger;
use Cake\Utility\Security;
/**
@@ -34,6 +36,16 @@ class WeakPasswordHasher extends AbstractPasswordHasher {
'hashType' => null
];
/**
* {@inheritDoc}
*/
public function __construct(array $config = []) {
if (Configure::read('debug')) {
Debugger::checkSecurityKeys();
}
parent::config($config);
}
/**
* Generates password hash.
*
@@ -18,13 +18,11 @@
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Error;
use Cake\Event\Event;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Routing\Router;
use Cake\Utility\Debugger;
use Cake\Utility\Hash;
/**
@@ -249,10 +247,6 @@ public function __construct(ComponentRegistry $registry, array $config = []) {
$this->response = $controller->response;
$this->_methods = $controller->methods;
$this->session = $controller->request->session();
if (Configure::read('debug')) {
Debugger::checkSecurityKeys();
}
}
/**
@@ -23,6 +23,17 @@
*/
class WeakPasswordHasherTest extends TestCase {
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
Configure::write('Security.salt', 'YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
}
/**
* Tests that any password not produced by WeakPasswordHasher needs
* to be rehashed

0 comments on commit c3038f7

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