/** * Set the password encryption algorithm * * @param string $algorithm One of the available password encryption * algorithms determined by {@link Security::get_encryption_algorithms()} * @return bool Returns TRUE if the passed algorithm was valid, otherwise FALSE. */ public static function set_password_encryption_algorithm($algorithm) { if (!array_key_exists($algorithm, PasswordEncryptor::get_encryptors())) { return false; } self::$encryptionAlgorithm = $algorithm; return true; }
function testUnregister() { Config::inst()->update('PasswordEncryptor', 'encryptors', array('test'=>array('PasswordEncryptorTest_TestEncryptor'=>null))); Config::inst()->remove('PasswordEncryptor', 'encryptors', 'test'); $this->assertNotContains('test', array_keys(PasswordEncryptor::get_encryptors())); }
function testUnregister() { PasswordEncryptor::register('test', 'PasswordEncryptorTest_TestEncryptor'); PasswordEncryptor::unregister('test'); $this->assertNotContains('test', array_keys(PasswordEncryptor::get_encryptors())); }