<commit_before>class Cfp::PasswordsController < ApplicationController
  layout 'signup'

  def new
    @user = User.new
  end

  def show
    redirect_to new_cfp_user_password_path
  end

  def create
    @user = User.find_by_email(params[:user][:email])
    if @user and @user.send_password_reset_instructions(@conference)
      redirect_to new_cfp_session_path, notice: t(:"cfp.sent_password_reset_instructions")
    else
      flash[:alert] = t(:"cfp.problem_sending_password_reset_instructions")
      redirect_to new_cfp_user_password_path
    end
  end

  def edit
    @user = User.new
    @user.reset_password_token = params[:reset_password_token]
  end

  def update
    @user = User.find_by_reset_password_token(params[:user][:reset_password_token])
    unless @user
      flash[:alert] = t(:"cfp.problem_sending_password_reset_instructions")
      return redirect_to new_cfp_user_password_path
    end

    if @user.reset_password(params[:user])
      login_as @user
      redirect_to cfp_person_path, notice: t(:"cfp.password_updated")
    else
      @user.reset_password_token = params[:user][:reset_password_token]
      render action: 'edit'
    end
  end
end
<commit_msg>password_controller: set user.confirmed_at when password was changed<commit_after>class Cfp::PasswordsController < ApplicationController
  layout 'signup'

  def new
    @user = User.new
  end

  def show
    redirect_to new_cfp_user_password_path
  end

  def create
    @user = User.find_by_email(params[:user][:email])
    if @user and @user.send_password_reset_instructions(@conference)
      redirect_to new_cfp_session_path, notice: t(:"cfp.sent_password_reset_instructions")
    else
      flash[:alert] = t(:"cfp.problem_sending_password_reset_instructions")
      redirect_to new_cfp_user_password_path
    end
  end

  def edit
    @user = User.new
    @user.reset_password_token = params[:reset_password_token]
  end

  def update
    @user = User.find_by_reset_password_token(params[:user][:reset_password_token])
    unless @user
      flash[:alert] = t(:"cfp.problem_sending_password_reset_instructions")
      return redirect_to new_cfp_user_password_path
    end

    if @user.reset_password(params[:user])
      login_as @user
      @user.skip_confirmation!
      @user.save
      redirect_to cfp_person_path, notice: t(:"cfp.password_updated")
    else
      @user.reset_password_token = params[:user][:reset_password_token]
      render action: 'edit'
    end
  end
end

{'fraction_non_alphanumeric': 0.08767676767676767, 'fraction_numerical': 0.0, 'mean_word_length': 4.136929460580913, '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': '5001109', 'n_tokens_mistral': 825, 'n_tokens_neox': 807, 'n_words': 148}