<commit_before>class Admin::SessionController < AdminController

  layout "admin/account"

  skip_before_filter :reload_config_and_roles
  skip_before_filter :set_preferences
  skip_before_filter :authenticate

  before_filter :create_an_account?, :except => [:destroy]

  def new
  end

  def create
    user = Typus.user_class.authenticate(params[:typus_user][:email], params[:typus_user][:password])

    if user
      session[:typus_user_id] = user.id
      path = params[:back_to] || admin_dashboard_path
    else
      alert = _("The email and/or password you entered is invalid.")
      path = new_admin_session_path(:back_to => params[:back_to])
    end

    redirect_to path, :alert => alert
  end

  def destroy
    session[:typus_user_id] = nil
    redirect_to :action => :new
  end

  private

  def create_an_account?
    redirect_to new_admin_account_path if Typus.user_class.count.zero?
  end

end
<commit_msg>Force setting I18n.default_locale when login out<commit_after>class Admin::SessionController < AdminController

  layout "admin/account"

  skip_before_filter :reload_config_and_roles
  skip_before_filter :set_preferences
  skip_before_filter :authenticate

  before_filter :create_an_account?, :except => [:destroy]

  def new
  end

  def create
    user = Typus.user_class.authenticate(params[:typus_user][:email], params[:typus_user][:password])

    if user
      session[:typus_user_id] = user.id
      path = params[:back_to] || admin_dashboard_path
    else
      alert = _("The email and/or password you entered is invalid.")
      path = new_admin_session_path(:back_to => params[:back_to])
    end

    redirect_to path, :alert => alert
  end

  def destroy
    session[:typus_user_id] = nil
    I18n.locale = I18n.default_locale
    redirect_to :action => :new
  end

  private

  def create_an_account?
    redirect_to new_admin_account_path if Typus.user_class.count.zero?
  end

end

{'fraction_non_alphanumeric': 0.08840353614144565, 'fraction_numerical': 0.0031201248049922, 'mean_word_length': 4.063157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1448708', 'n_tokens_mistral': 640, 'n_tokens_neox': 614, 'n_words': 139}