mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Compare commits
2 Commits
4e2a9d2984
...
01ec7c7be3
Author | SHA1 | Date | |
---|---|---|---|
|
01ec7c7be3 | ||
|
88a1f0362f |
@ -28,7 +28,7 @@ class LegacyParamArgvInput extends ArgvInput
|
||||
|
||||
public function __construct(?array $argv = null, ?InputDefinition $definition = null)
|
||||
{
|
||||
Deprecation::withSuppressedNotice(
|
||||
Deprecation::withNoReplacement(
|
||||
fn() => Deprecation::notice('6.0.0', 'Use ' . ArgvInput::class . ' instead', Deprecation::SCOPE_CLASS)
|
||||
);
|
||||
$argv ??= $_SERVER['argv'] ?? [];
|
||||
@ -105,7 +105,7 @@ class LegacyParamArgvInput extends ArgvInput
|
||||
$tokens = ArrayLib::insertBefore($tokens, $convertedFlags, '--', true, true);
|
||||
}
|
||||
if ($hadLegacyParams) {
|
||||
// We only want the "notice" once regardless of how many params there are.
|
||||
// We only want the warning once regardless of how many params there are.
|
||||
Deprecation::notice(
|
||||
'6.0.0',
|
||||
'Using `param=value` style flags is deprecated. Use `--flag=value` CLI flags instead.',
|
||||
|
@ -44,7 +44,6 @@ use SilverStripe\Forms\FormField;
|
||||
use SilverStripe\Forms\SearchableDropdownField;
|
||||
use SilverStripe\Forms\SearchableMultiDropdownField;
|
||||
use SilverStripe\ORM\FieldType\DBForeignKey;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* The member class which represents the users of the system
|
||||
@ -401,7 +400,7 @@ class Member extends DataObject
|
||||
public static function password_validator()
|
||||
{
|
||||
if (Injector::inst()->has(PasswordValidator::class)) {
|
||||
return Deprecation::withSuppressedNotice(fn() => Injector::inst()->get(PasswordValidator::class));
|
||||
return Injector::inst()->get(PasswordValidator::class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Extensible;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
use SilverStripe\Core\Validation\ValidationResult;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* This class represents a validator for member passwords.
|
||||
@ -20,8 +19,6 @@ use SilverStripe\Dev\Deprecation;
|
||||
*
|
||||
* Member::set_password_validator($pwdValidator);
|
||||
* </code>
|
||||
*
|
||||
* @deprecated 5.4.0 Will be renamed to SilverStripe\Security\Validation\RulesPasswordValidator
|
||||
*/
|
||||
class PasswordValidator
|
||||
{
|
||||
@ -78,15 +75,6 @@ class PasswordValidator
|
||||
*/
|
||||
protected $historicalPasswordCount = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
Deprecation::notice(
|
||||
'5.4.0',
|
||||
'Will be renamed to SilverStripe\Security\Validation\RulesPasswordValidator',
|
||||
Deprecation::SCOPE_CLASS
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
@ -15,7 +15,6 @@ use SilverStripe\Security\PasswordValidator;
|
||||
use SilverStripe\View\SSViewer;
|
||||
use Closure;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
{
|
||||
@ -25,11 +24,9 @@ class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Deprecation::withSuppressedNotice(
|
||||
fn() => PasswordValidator::singleton()
|
||||
PasswordValidator::singleton()
|
||||
->setMinLength(0)
|
||||
->setTestNames([])
|
||||
);
|
||||
->setTestNames([]);
|
||||
}
|
||||
|
||||
public function testSetValue()
|
||||
|
@ -6,7 +6,6 @@ use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\NullHTTPRequest;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\Core\Validation\ValidationResult;
|
||||
@ -45,11 +44,9 @@ class MemberAuthenticatorTest extends SapphireTest
|
||||
DefaultAdminService::setDefaultAdmin('admin', 'password');
|
||||
|
||||
// Enforce dummy validation (this can otherwise be influenced by recipe config)
|
||||
Deprecation::withSuppressedNotice(
|
||||
fn() => PasswordValidator::singleton()
|
||||
PasswordValidator::singleton()
|
||||
->setMinLength(0)
|
||||
->setTestNames([])
|
||||
);
|
||||
->setTestNames([]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace SilverStripe\Security\Tests;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\MemberCsvBulkLoader;
|
||||
@ -20,11 +19,9 @@ class MemberCsvBulkLoaderTest extends SapphireTest
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Deprecation::withSuppressedNotice(
|
||||
fn() => PasswordValidator::singleton()
|
||||
PasswordValidator::singleton()
|
||||
->setMinLength(0)
|
||||
->setTestNames([])
|
||||
);
|
||||
->setTestNames([]);
|
||||
}
|
||||
|
||||
public function testNewImport()
|
||||
|
@ -8,7 +8,6 @@ use SilverStripe\Control\Cookie;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
@ -75,11 +74,9 @@ class MemberTest extends FunctionalTest
|
||||
|
||||
Member::config()->set('unique_identifier_field', 'Email');
|
||||
|
||||
Deprecation::withSuppressedNotice(
|
||||
fn() => PasswordValidator::singleton()
|
||||
PasswordValidator::singleton()
|
||||
->setMinLength(0)
|
||||
->setTestNames([])
|
||||
);
|
||||
->setTestNames([]);
|
||||
|
||||
i18n::set_locale('en_US');
|
||||
}
|
||||
@ -1743,7 +1740,7 @@ class MemberTest extends FunctionalTest
|
||||
public function testChangePasswordOnlyValidatesPlaintext()
|
||||
{
|
||||
// This validator requires passwords to be 17 characters long
|
||||
Member::set_password_validator(Deprecation::withSuppressedNotice(fn() => new MemberTest\VerySpecificPasswordValidator()));
|
||||
Member::set_password_validator(new MemberTest\VerySpecificPasswordValidator());
|
||||
|
||||
// This algorithm will never return a 17 character hash
|
||||
Security::config()->set('password_encryption_algorithm', 'blowfish');
|
||||
@ -1772,7 +1769,7 @@ class MemberTest extends FunctionalTest
|
||||
|
||||
public function testChangePasswordToBlankIsValidated()
|
||||
{
|
||||
Member::set_password_validator(Deprecation::withSuppressedNotice(fn() => new PasswordValidator()));
|
||||
Member::set_password_validator(new PasswordValidator());
|
||||
// override setup() function which setMinLength(0)
|
||||
PasswordValidator::singleton()->setMinLength(8);
|
||||
// 'test' member has a password defined in yml
|
||||
@ -1908,7 +1905,7 @@ class MemberTest extends FunctionalTest
|
||||
$password = $member->generateRandomPassword();
|
||||
$this->assertSame(20, strlen($password));
|
||||
// password validator
|
||||
$validator = Deprecation::withSuppressedNotice(fn() => new PasswordValidator());
|
||||
$validator = new PasswordValidator();
|
||||
Member::set_password_validator($validator);
|
||||
// Password length of 20 even if validator minLength is less than 20
|
||||
$validator->setMinLength(10);
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace SilverStripe\Security\Tests;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\PasswordValidator;
|
||||
@ -27,7 +26,7 @@ class PasswordValidatorTest extends SapphireTest
|
||||
|
||||
public function testValidate()
|
||||
{
|
||||
$v = Deprecation::withSuppressedNotice(fn() => new PasswordValidator());
|
||||
$v = new PasswordValidator();
|
||||
$r = $v->validate('', new Member());
|
||||
$this->assertTrue($r->isValid(), 'Empty password is valid by default');
|
||||
|
||||
@ -37,7 +36,7 @@ class PasswordValidatorTest extends SapphireTest
|
||||
|
||||
public function testValidateMinLength()
|
||||
{
|
||||
$v = Deprecation::withSuppressedNotice(fn() => new PasswordValidator());
|
||||
$v = new PasswordValidator();
|
||||
|
||||
$v->setMinLength(4);
|
||||
$r = $v->validate('123', new Member());
|
||||
@ -51,7 +50,7 @@ class PasswordValidatorTest extends SapphireTest
|
||||
public function testValidateMinScore()
|
||||
{
|
||||
// Set both score and set of tests
|
||||
$v = Deprecation::withSuppressedNotice(fn() => new PasswordValidator());
|
||||
$v = new PasswordValidator();
|
||||
$v->setMinTestScore(3);
|
||||
$v->setTestNames(["lowercase", "uppercase", "digits", "punctuation"]);
|
||||
|
||||
@ -62,7 +61,7 @@ class PasswordValidatorTest extends SapphireTest
|
||||
$this->assertTrue($r->isValid(), 'Passing enough tests');
|
||||
|
||||
// Ensure min score without tests works (uses default tests)
|
||||
$v = Deprecation::withSuppressedNotice(fn() => new PasswordValidator());
|
||||
$v = new PasswordValidator();
|
||||
$v->setMinTestScore(3);
|
||||
|
||||
$r = $v->validate('aA', new Member());
|
||||
@ -82,7 +81,7 @@ class PasswordValidatorTest extends SapphireTest
|
||||
*/
|
||||
public function testHistoricalPasswordCount()
|
||||
{
|
||||
$validator = Deprecation::withSuppressedNotice(fn() => new PasswordValidator);
|
||||
$validator = new PasswordValidator;
|
||||
$validator->setHistoricCount(3);
|
||||
Member::set_password_validator($validator);
|
||||
|
||||
|
@ -6,7 +6,6 @@ use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\NullHTTPRequest;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\Core\Validation\ValidationResult;
|
||||
@ -44,11 +43,9 @@ class VersionedMemberAuthenticatorTest extends SapphireTest
|
||||
}
|
||||
|
||||
// Enforce dummy validation (this can otherwise be influenced by recipe config)
|
||||
Deprecation::withSuppressedNotice(
|
||||
fn() => PasswordValidator::singleton()
|
||||
PasswordValidator::singleton()
|
||||
->setMinLength(0)
|
||||
->setTestNames([])
|
||||
);
|
||||
->setTestNames([]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
Loading…
Reference in New Issue
Block a user