<commit_before>class SessionsController < Clearance::SessionsController

  def create
    @user = authenticate(params)

    sign_in(@user) do |status|
      if status.success?
        redirect_to params[:referer]
      else
        flash[:alert] = status.failure_message
        render template: "sessions/new", status: :unauthorized
      end
    end
  end
end<commit_msg>Adds a redirection to the reset password page for users that have not encrypted passwords<commit_after>class SessionsController < Clearance::SessionsController

  def create
    if params[:session][:password] && User.find_by(email: params[:session][:email]).encrypted_password === 'x'
      redirect_to  new_password_path, flash: { :info => "Due to a security update from our side we kindly ask you to reset your password." }

    else @user = authenticate(params)

      sign_in(@user) do |status|

        if status.success?
            redirect_to params[:referer]
        else
          flash[:alert] = status.failure_message
          render template: "sessions/new", status: :unauthorized
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08852755194218609, 'fraction_numerical': 0.0, 'mean_word_length': 3.149812734082397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '2123159', 'n_tokens_mistral': 312, 'n_tokens_neox': 299, 'n_words': 92}