mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge branch '5.3' into 5
This commit is contained in:
commit
7b73b01505
@ -12,6 +12,7 @@ use SilverStripe\Security\Member;
|
|||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\MFA\Model\RegisteredMethod;
|
use SilverStripe\MFA\Model\RegisteredMethod;
|
||||||
|
use SilverStripe\Security\PasswordValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoginContext
|
* LoginContext
|
||||||
@ -315,14 +316,21 @@ class LoginContext implements Context
|
|||||||
|
|
||||||
// make sure any validation for password is skipped, since we're not testing complexity here
|
// make sure any validation for password is skipped, since we're not testing complexity here
|
||||||
$validator = Member::password_validator();
|
$validator = Member::password_validator();
|
||||||
Member::set_password_validator(null);
|
$nullValidator = new PasswordValidator();
|
||||||
|
$nullValidator->setMinLength(0);
|
||||||
|
$nullValidator->setMinTestScore(0);
|
||||||
|
$nullValidator->setHistoricCount(0);
|
||||||
|
Member::set_password_validator($nullValidator);
|
||||||
|
|
||||||
|
// Write member record
|
||||||
$member->FirstName = $identifier;
|
$member->FirstName = $identifier;
|
||||||
$member->Surname = "User";
|
$member->Surname = "User";
|
||||||
$member->Email = $email;
|
$member->Email = $email;
|
||||||
$member->PasswordEncryption = "none";
|
|
||||||
$member->changePassword($password);
|
$member->changePassword($password);
|
||||||
$member->write();
|
$member->write();
|
||||||
$group->Members()->add($member);
|
$group->Members()->add($member);
|
||||||
|
|
||||||
|
// Set password validator back to what it was
|
||||||
Member::set_password_validator($validator);
|
Member::set_password_validator($validator);
|
||||||
|
|
||||||
return $member;
|
return $member;
|
||||||
|
Loading…
Reference in New Issue
Block a user