mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Don't leave cost=31 blowfish setting dormant in code, causing timeouts.
This commit is contained in:
parent
a1e7c1f9bf
commit
09e821efc3
@ -15,6 +15,7 @@ class PasswordEncryptorTest extends SapphireTest {
|
|||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
Config::set_instance($this->config);
|
Config::set_instance($this->config);
|
||||||
|
PasswordEncryptor_Blowfish::set_cost(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateForCode() {
|
function testCreateForCode() {
|
||||||
@ -86,11 +87,11 @@ class PasswordEncryptorTest extends SapphireTest {
|
|||||||
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
|
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
|
||||||
$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
|
$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
|
||||||
|
|
||||||
PasswordEncryptor_Blowfish::set_cost(15);
|
PasswordEncryptor_Blowfish::set_cost(11);
|
||||||
$salt = $e->salt($password);
|
$salt = $e->salt($password);
|
||||||
$modSalt = substr($salt, 0, 3) . str_shuffle(substr($salt, 3, strlen($salt)));
|
$modSalt = substr($salt, 0, 3) . str_shuffle(substr($salt, 3, strlen($salt)));
|
||||||
|
|
||||||
$this->assertEquals(15, PasswordEncryptor_Blowfish::get_cost());
|
$this->assertEquals(11, PasswordEncryptor_Blowfish::get_cost());
|
||||||
|
|
||||||
$this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
|
$this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
|
||||||
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
|
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
|
||||||
@ -103,10 +104,6 @@ class PasswordEncryptorTest extends SapphireTest {
|
|||||||
$this->assertEquals(31, PasswordEncryptor_Blowfish::get_cost());
|
$this->assertEquals(31, PasswordEncryptor_Blowfish::get_cost());
|
||||||
|
|
||||||
//Don't actually test this one. It takes too long. 31 takes too long to process
|
//Don't actually test this one. It takes too long. 31 takes too long to process
|
||||||
// $salt = $e->salt($password);
|
|
||||||
// $this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
|
|
||||||
// $this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEncryptorPHPHashCheck() {
|
function testEncryptorPHPHashCheck() {
|
||||||
|
Loading…
Reference in New Issue
Block a user