@@ -23,7 +23,7 module Redmine | |||
|
23 | 23 | |
|
24 | 24 | class << self |
|
25 | 25 | def encrypt_text(text) |
|
26 | if cipher_key.blank? | |
|
26 | if cipher_key.blank? || text.blank? | |
|
27 | 27 | text |
|
28 | 28 | else |
|
29 | 29 | c = OpenSSL::Cipher::Cipher.new("aes-256-cbc") |
@@ -43,6 +43,14 class Redmine::CipheringTest < ActiveSupport::TestCase | |||
|
43 | 43 | end |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | def test_blank_password_should_be_clear | |
|
47 | Redmine::Configuration.with 'database_cipher_key' => 'secret' do | |
|
48 | r = Repository::Subversion.generate!(:password => '') | |
|
49 | assert_equal '', r.password | |
|
50 | assert_equal '', r.read_attribute(:password) | |
|
51 | end | |
|
52 | end | |
|
53 | ||
|
46 | 54 | def test_unciphered_password_should_be_readable |
|
47 | 55 | Redmine::Configuration.with 'database_cipher_key' => nil do |
|
48 | 56 | r = Repository::Subversion.generate!(:password => 'clear') |
General Comments 0
You need to be logged in to leave comments.
Login now