<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :authentication

  def authentication
    if session.has_key?'warden.user.user.key'
        if request.fullpath == '/login'
            redirect_to '/'
        end
    else
        if request.fullpath == '/'
            redirect_to '/login'
        end

    end
  end
end<commit_msg>Security Fix: When not logged in, if path not '/login', will be redircted to login.<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :authentication

  def authentication
    if session.has_key?'warden.user.user.key'
        if request.fullpath == '/login'
            redirect_to '/'
        end
    else
        if request.fullpath != '/login'
            redirect_to '/login'
        end

    end
  end
end
{'fraction_non_alphanumeric': 0.08304093567251462, 'fraction_numerical': 0.0, 'mean_word_length': 2.4377510040160644, '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': '4613937', 'n_tokens_mistral': 240, 'n_tokens_neox': 235, 'n_words': 62}