public function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     foreach ($this->priorAuthenticators as $authenticator) {
         Authenticator::unregister($authenticator);
     }
     Authenticator::register('SilverStripe\\Security\\MemberAuthenticator');
     Authenticator::set_default_authenticator('SilverStripe\\Security\\MemberAuthenticator');
     // And that the unique identified field is 'Email'
     $this->priorUniqueIdentifierField = Member::config()->unique_identifier_field;
     $this->priorRememberUsername = Security::config()->remember_username;
     Member::config()->unique_identifier_field = 'Email';
     parent::setUp();
 }
 public function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     foreach ($this->priorAuthenticators as $authenticator) {
         Authenticator::unregister($authenticator);
     }
     Authenticator::register('SilverStripe\\Security\\MemberAuthenticator');
     Authenticator::set_default_authenticator('SilverStripe\\Security\\MemberAuthenticator');
     // And that the unique identified field is 'Email'
     $this->priorUniqueIdentifierField = Member::config()->unique_identifier_field;
     $this->priorRememberUsername = Security::config()->remember_username;
     /** @skipUpgrade */
     Member::config()->unique_identifier_field = 'Email';
     parent::setUp();
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/');
 }
 /**
  * Get the selected authenticator for this request
  *
  * @return string Class name of Authenticator
  */
 protected function getAuthenticator()
 {
     $authenticator = $this->getRequest()->requestVar('AuthenticationMethod');
     if ($authenticator) {
         $authenticators = Authenticator::get_authenticators();
         if (in_array($authenticator, $authenticators)) {
             return $authenticator;
         }
     } else {
         return Authenticator::get_default_authenticator();
     }
 }