Skip to content

Commit

Permalink
Solving a few problems found in code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 3, 2014
1 parent 260d046 commit f0039fd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Component/Auth/AbstractPasswordHasher.php
Expand Up @@ -72,7 +72,7 @@ abstract public function check($password, $hashedPassword);
* @return boolean
*/
public function needsRehash($password) {
return true;
return password_needs_rehash($password, PASSWORD_DEFAULT);
}

}
6 changes: 3 additions & 3 deletions src/Controller/Component/Auth/WeakPasswordHasher.php
Expand Up @@ -9,7 +9,7 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
Expand All @@ -19,8 +19,8 @@

/**
* Password hashing class that use weak hashing algorithms. This class is
* intended only to be used with legacy databases where passwords have not
* been migrated yet to a stronger algorithm.
* intended only to be used with legacy databases where passwords have
* not been migrated to a stronger algorithm yet.
*
*/
class WeakPasswordHasher extends AbstractPasswordHasher {
Expand Down
Expand Up @@ -24,7 +24,7 @@
class SimplePasswordHasherTest extends TestCase {

/**
* Tests that a pssword not produced by SimplePasswordHasher needs
* Tests that a password not produced by SimplePasswordHasher needs
* to be rehashed
*
* @return void
Expand Down
Expand Up @@ -33,6 +33,7 @@ public function testNeedsRehash() {
$hasher = new WeakPasswordHasher();
$this->assertTrue($hasher->needsRehash(md5('foo')));
$this->assertTrue($hasher->needsRehash('bar'));
$this->assertFalse($hasher->needsRehash('$2y$10$juOA0XVFpvZa0KTxRxEYVuX5kIS7U1fKDRcxyYhhUQECN1oHYnBMy'));
}

/**
Expand Down

0 comments on commit f0039fd

Please sign in to comment.