mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Disallow negative values for FailedLoginCount (#10200)
This commit is contained in:
parent
465ca1d16d
commit
cbf2987a61
@ -937,6 +937,11 @@ class Member extends DataObject
|
|||||||
$this->Locale = i18n::config()->get('default_locale');
|
$this->Locale = i18n::config()->get('default_locale');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure FailedLoginCount is non-negative
|
||||||
|
if ($this->FailedLoginCount < 0) {
|
||||||
|
$this->FailedLoginCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1270,6 +1270,15 @@ class MemberTest extends FunctionalTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFailedLoginCountNegative()
|
||||||
|
{
|
||||||
|
/** @var Member $member */
|
||||||
|
$member = $this->objFromFixture(Member::class, 'test');
|
||||||
|
$member->FailedLoginCount = -1;
|
||||||
|
$member->write();
|
||||||
|
$this->assertSame(0, $member->FailedLoginCount);
|
||||||
|
}
|
||||||
|
|
||||||
public function testMemberValidator()
|
public function testMemberValidator()
|
||||||
{
|
{
|
||||||
// clear custom requirements for this test
|
// clear custom requirements for this test
|
||||||
|
Loading…
Reference in New Issue
Block a user