<commit_before>module Blog
  class Admin::ApplicationController < ActionController::Base
    layout "blog/admin"

    force_ssl if: :ssl_configured?
    protect_from_forgery with: :exception

    def ssl_configured?
      Rails.env.production?
    end
  end
end
<commit_msg>Add authentication requirement for blog/admin<commit_after>module Blog
  class Admin::ApplicationController < ActionController::Base
    layout "blog/admin"

    force_ssl if: :ssl_configured?
    protect_from_forgery with: :exception

    # Require authentication if in host application and devise is present.
    #
    # Otherwise authentication not required in testing environment.
    before_filter :authenticate_user! if defined? authenticate_user!

    def ssl_configured?
      Rails.env.production?
    end
  end
end

{'fraction_non_alphanumeric': 0.0625782227784731, 'fraction_numerical': 0.0, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785527', 'n_tokens_mistral': 227, 'n_tokens_neox': 217, 'n_words': 64}