<commit_before>class SessionsController < ApplicationController
  layout 'admin'
  filter_parameter_logging 'password', 'password_confirmation'
  before_filter :redirect?, :only => [:new, :create]

  def create
    if UserSession.create(params[:session])
      redirect_back_or_default(admin_root_url)
      flash[:notice] = "Logged in successfully"
    else
      render :action => 'new'
    end
  end

  def destroy
    current_user_session.destroy if logged_in?
    flash[:notice] = "You have been logged out."
    redirect_back_or_default(new_session_url)
  end

protected

  def redirect?
    redirect_to admin_root_url if logged_in?
  end

  def take_down_for_maintenance?;end

end<commit_msg>Welcome the user with a flash message and validate the new session properly.<commit_after>class SessionsController < ApplicationController
  layout 'admin'
  filter_parameter_logging 'password', '<PASSWORD>'
  before_filter :redirect?, :only => [:new, :create]

  def new
    @session = UserSession.new
    flash[:notice] = "Welcome. Sign into #{RefinerySetting[:site_name]}"
  end

  def create
    if (@session = UserSession.create(params[:session])).valid?
      redirect_back_or_default(admin_root_url)
      flash[:notice] = "Logged in successfully"
    else
      render :action => 'new'
    end
  end

  def destroy
    current_user_session.destroy if logged_in?
    flash[:notice] = "You have been logged out."
    redirect_back_or_default(new_session_url)
  end

protected

  def redirect?
    redirect_to admin_root_url if logged_in?
  end

  def take_down_for_maintenance?;end

end
{'fraction_non_alphanumeric': 0.08610936517913262, 'fraction_numerical': 0.0, 'mean_word_length': 4.2026143790849675, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '1891210', 'n_tokens_mistral': 488, 'n_tokens_neox': 476, 'n_words': 126}