mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Fixed unit tests after change Member->checkPassword() to return ValidationResult instead of boolean (see r98268) (merged from r98274)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@99701 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
41c04fe61b
commit
61e27830c6
@ -42,7 +42,7 @@ class MemberAuthenticator extends Authenticator {
|
||||
"Member",
|
||||
"\"Email\" = '$SQL_user' AND \"Password\" IS NOT NULL"
|
||||
);
|
||||
$result = $member->checkPassword($RAW_data['Password']);
|
||||
$result = ($member) ? $member->checkPassword($RAW_data['Password']) : false;
|
||||
|
||||
if($member && !$result->valid()) {
|
||||
$member->registerFailedLogin();
|
||||
|
@ -22,7 +22,8 @@ class MemberAuthenticatorTest extends SapphireTest {
|
||||
|
||||
$member = DataObject::get_by_id('Member', $member->ID);
|
||||
$this->assertEquals($member->PasswordEncryption, "sha1_v2.4");
|
||||
$this->assertTrue($member->checkPassword('mypassword'));
|
||||
$result = $member->checkPassword('mypassword');
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
|
||||
function testNoLegacyPasswordHashMigrationOnIncompatibleAlgorithm() {
|
||||
@ -42,6 +43,7 @@ class MemberAuthenticatorTest extends SapphireTest {
|
||||
|
||||
$member = DataObject::get_by_id('Member', $member->ID);
|
||||
$this->assertEquals($member->PasswordEncryption, "crc32");
|
||||
$this->assertTrue($member->checkPassword('mypassword'));
|
||||
$result = $member->checkPassword('mypassword');
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
}
|
@ -38,14 +38,16 @@ class MemberTest extends FunctionalTest {
|
||||
$member->PasswordEncryption,
|
||||
'sha1_v2.4'
|
||||
);
|
||||
$this->assertTrue($member->checkPassword("mynewpassword"));
|
||||
$result = $member->checkPassword('mynewpassword');
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
|
||||
function testSetPassword() {
|
||||
$member = $this->objFromFixture('Member', 'test');
|
||||
$member->Password = "test1";
|
||||
$member->write();
|
||||
$this->assertTrue($member->checkPassword("test1"));
|
||||
$result = $member->checkPassword('test1');
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ class SecurityTest extends FunctionalTest {
|
||||
/* THE FIRST 4 TIMES, THE MEMBER SHOULDN'T BE LOCKED OUT */
|
||||
if($i < 5) {
|
||||
$this->assertNull($member->LockedOutUntil);
|
||||
$this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORWRONGCRED')));
|
||||
$this->assertContains($this->loginErrorMessage(), _t('Member.ERRORWRONGCRED'));
|
||||
}
|
||||
|
||||
/* AFTER THAT THE USER IS LOCKED OUT FOR 15 MINUTES */
|
||||
@ -165,7 +165,8 @@ class SecurityTest extends FunctionalTest {
|
||||
}
|
||||
|
||||
if($i > 5) {
|
||||
$this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORLOCKEDOUT')));
|
||||
$this->assertContains(_t('Member.ERRORLOCKEDOUT'), $this->loginErrorMessage());
|
||||
// $this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORLOCKEDOUT')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ class EncryptAllPasswordsTaskTest extends SapphireTest {
|
||||
$m = DataObject::get_by_id('Member', $m->ID);
|
||||
$this->assertEquals($m->PasswordEncryption, 'sha1_v2.4');
|
||||
$this->assertNotEquals($m->Password, 'plain');
|
||||
$this->assertTrue($m->checkPassword('plain'));
|
||||
$result = $m->checkPassword('plain');
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user