Browse Source

Allow passing options to password_hash().

ADmad 11 years ago
parent
commit
4e4c1250b6
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/Auth/DefaultPasswordHasher.php

+ 8 - 3
src/Auth/DefaultPasswordHasher.php

@@ -9,7 +9,7 @@
  *
  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  * @link          http://cakephp.org CakePHP(tm) Project
- * @since         2.4.0
+ * @since         3.0.0
  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
  */
 namespace Cake\Auth;
@@ -28,7 +28,8 @@ class DefaultPasswordHasher extends AbstractPasswordHasher {
  * @var array
  */
 	protected $_defaultConfig = [
-		'hashType' => PASSWORD_DEFAULT
+		'hashType' => PASSWORD_DEFAULT,
+		'hashOptions' => []
 	];
 
 /**
@@ -39,7 +40,11 @@ class DefaultPasswordHasher extends AbstractPasswordHasher {
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
  */
 	public function hash($password) {
-		return password_hash($password, $this->_config['hashType']);
+		return password_hash(
+			$password,
+			$this->_config['hashType'],
+			$this->_config['hashOptions']
+		);
 	}
 
 /**