Fixed: crypting blank passwords raises an error (#9137).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7985 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d92c204ed3
commit
fd24250be0
|
@ -23,7 +23,7 @@ module Redmine
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def encrypt_text(text)
|
def encrypt_text(text)
|
||||||
if cipher_key.blank?
|
if cipher_key.blank? || text.blank?
|
||||||
text
|
text
|
||||||
else
|
else
|
||||||
c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
||||||
|
|
|
@ -43,6 +43,14 @@ class Redmine::CipheringTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_unciphered_password_should_be_readable
|
||||||
Redmine::Configuration.with 'database_cipher_key' => nil do
|
Redmine::Configuration.with 'database_cipher_key' => nil do
|
||||||
r = Repository::Subversion.generate!(:password => 'clear')
|
r = Repository::Subversion.generate!(:password => 'clear')
|
||||||
|
|
Loading…
Reference in New Issue