class << self
def encrypt_text(text)
- if cipher_key.blank?
+ if cipher_key.blank? || text.blank?
text
else
c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
end
end
+ def test_blank_password_should_be_clear
+ Redmine::Configuration.with 'database_cipher_key' => 'secret' do
+ r = Repository::Subversion.generate!(:password => '')
+ assert_equal '', r.password
+ assert_equal '', r.read_attribute(:password)
+ end
+ end
+
def test_unciphered_password_should_be_readable
Redmine::Configuration.with 'database_cipher_key' => nil do
r = Repository::Subversion.generate!(:password => 'clear')