diff --git a/app/helpers/check_helper.rb b/app/helpers/check_helper.rb
index 09d5a13..e1dd5fe 100644
--- a/app/helpers/check_helper.rb
+++ b/app/helpers/check_helper.rb
@@ -1,2 +1,110 @@
module CheckHelper
+ def rank_color(rank)
+ case rank
+ when 'A+' then :primary
+ when 'A' then :success
+ when 'B' then :default
+ when 'C', 'D' then :warning
+ when 'E', 'F' then :danger
+ else :error
+ end
+ end
+
+ def rank_label(rank)
+ "#{rank}".html_safe
+ end
+
+ def progress_color(percentage)
+ case percentage
+ when 0...20 then :error
+ when 20...40 then :danger
+ when 40...60 then :warning
+ when 60...80 then :default
+ when 80...90 then :success
+ else :primary
+ end
+ end
+
+ def score_progress(score)
+ %Q(
).html_safe
+ end
+
+ def protocol_label(protocol)
+ color = case protocol.to_s
+ when 'TLSv1_2' then :success
+ when 'SSLv3', 'SSLv2' then :danger
+ else :default
+ end
+ "#{protocol}".html_safe
+ end
+
+ def protocol_labels(protocols)
+ protocols.collect { |p| protocol_label p }.join("\n").html_safe
+ end
+
+ def key_label(key)
+ return 'Aucune'.html_safe unless key
+ "#{key.type.upcase} #{key[:size]} bits".html_safe
+ end
+
+ def key_labels(keys)
+ return 'Aucune'.html_safe if keys.empty?
+ keys.sort { |a, b| -1 * (a.rsa_size <=> b.rsa_size)} .collect { |k| key_label k }.join("\n").html_safe
+ end
+
+ def cipher_size_label(cipher)
+ size = cipher.kind_of?(CryptCheck::Tls::Cipher) ? cipher.size : cipher['size']
+ "\">#{size} bits".html_safe
+ end
+
+ def color_key(key)
+ case key.rsa_size
+ when 0...1024 then :error
+ when 1024...2048 then :danger
+ when 2048...4096 then :warning
+ else :success
+ end
+ end
+
+ def cipher_color(key)
+ case key
+ when 0...112 then :danger
+ when 112...128 then :warning
+ when 128...256 then :success
+ else :primary
+ end
+ end
+
+ def cipher_name_label(cipher, state)
+ color = case
+ when !state[:danger].empty? then :danger
+ when !state[:warning].empty? then :warning
+ when !state[:success].empty? then :success
+ else :default
+ end
+ color = :primary if color == :success and cipher.size >= 256
+ "\">#{cipher.name}".html_safe
+ end
+
+ def cipher_labels(cipher)
+ case cipher
+ when Hashie::Mash
+ { success: %i(pfs),
+ warning: %i(des3 sha1),
+ danger: %i(dss md5 psk srp anonymous null export des rc2 rc4)
+ }.collect do |c, ts|
+ ts.select { |t| CryptCheck::Tls::Cipher.send "#{t}?", cipher.name }.collect { |t| [c, t] }
+ end
+ when Hash
+ cipher.collect { |c, ts| ts.collect { |t| [c, t] } }
+ end
+ .flatten(1)
+ .collect { |c, t| "#{t.upcase}" }
+ .join("\n").html_safe
+ end
end
diff --git a/app/helpers/site_helper.rb b/app/helpers/site_helper.rb
index d0ceb79..c879486 100644
--- a/app/helpers/site_helper.rb
+++ b/app/helpers/site_helper.rb
@@ -1,110 +1,2 @@
module SiteHelper
- def rank_color(rank)
- case rank
- when 'A+' then :primary
- when 'A' then :success
- when 'B' then :default
- when 'C', 'D' then :warning
- when 'E', 'F' then :danger
- else :error
- end
- end
-
- def rank_label(rank)
- "#{rank}".html_safe
- end
-
- def progress_color(percentage)
- case percentage
- when 0...20 then :error
- when 20...40 then :danger
- when 40...60 then :warning
- when 60...80 then :default
- when 80...90 then :success
- else :primary
- end
- end
-
- def score_progress(score)
- %Q().html_safe
- end
-
- def protocol_label(protocol)
- color = case protocol.to_s
- when 'TLSv1_2' then :success
- when 'SSLv3', 'SSLv2' then :danger
- else :default
- end
- "#{protocol}".html_safe
- end
-
- def protocol_labels(protocols)
- protocols.collect { |p| protocol_label p }.join("\n").html_safe
- end
-
- def key_label(key)
- return 'Aucune'.html_safe unless key
- "#{key.type.upcase} #{key[:size]} bits".html_safe
- end
-
- def key_labels(keys)
- return 'Aucune'.html_safe if keys.empty?
- keys.sort { |a, b| -1 * (a.rsa_size <=> b.rsa_size)} .collect { |k| key_label k }.join("\n").html_safe
- end
-
- def cipher_size_label(cipher)
- size = cipher.kind_of?(CryptCheck::Tls::Cipher) ? cipher.size : cipher['size']
- "\">#{size} bits".html_safe
- end
-
- def color_key(key)
- case key.rsa_size
- when 0...1024 then :error
- when 1024...2048 then :danger
- when 2048...4096 then :warning
- else :success
- end
- end
-
- def cipher_color(key)
- case key
- when 0...112 then :danger
- when 112...128 then :warning
- when 128...256 then :success
- else :primary
- end
- end
-
- def cipher_name_label(cipher, state)
- color = case
- when !state[:danger].empty? then :danger
- when !state[:warning].empty? then :warning
- when !state[:success].empty? then :success
- else :default
- end
- color = :primary if color == :success and cipher.size >= 256
- "\">#{cipher.name}".html_safe
- end
-
- def cipher_labels(cipher)
- case cipher
- when Hashie::Mash
- { success: %i(pfs),
- warning: %i(des3 sha1),
- danger: %i(dss md5 psk srp anonymous null export des rc2 rc4)
- }.collect do |c, ts|
- ts.select { |t| CryptCheck::Tls::Cipher.send "#{t}?", cipher.name }.collect { |t| [c, t] }
- end
- when Hash
- cipher.collect { |c, ts| ts.collect { |t| [c, t] } }
- end
- .flatten(1)
- .collect { |c, t| "#{t.upcase}" }
- .join("\n").html_safe
- end
end
diff --git a/config/application.rb b/config/application.rb
index 823cf46..6cc2195 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -39,6 +39,7 @@ module CryptcheckRails
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :fr
+ config.action_controller.include_all_helpers = false
config.refresh_delay = 1.hour
end