<commit_before>class UsersController < ApplicationController

  def new
    @page_title = "Sign up"

    @user = User.new
  end

  def create
    @user = User.new

    @user.username = params[:user][:username]
    @user.password = params[:user][:password]
    @user.email = params[:user][:email]

    if @user.save
      flash[:success] = "Successfully signed up, signed in as #{@user.username}"
      session[:user_id] = @user.id

      goto_return_url_or_root
    else
      render 'new'
    end
  end

  def profile
    @user = User.where(:id => params[:id]).first
    @page_title = "Profile for #{@user.display_name}"
  end

  def email_confirm
    @user = User.where(:email_confirmation_token => params[:token]).first

    if @user.blank?
      flash[:notice] = "Invalid email confirmation token"
      redirect_to(root_url)
      return
    end

    if @user.email_confirmed
      flash[:notice] = "Email address is already confirmed"
      redirect_to(root_url)
      return
    end

    @user.email_confirmed = true
    if @user.save
      flash[:success] = "Your email address has been confirmed"
      redirect_to(root_url)
    else
      flash[:notice] = "Something went wrong while trying to confirm your email address, please contact us at the forums"
      redirect_to(root_url)
    end<commit_msg>flash messages (using correct css class)<commit_after>class UsersController < ApplicationController

  def new
    @page_title = "Sign up"

    @user = User.new
  end

  def create
    @user = User.new

    @user.username = params[:user][:username]
    @user.password = params[:user][:password]
    @user.email = params[:user][:email]

    if @user.save
      flash[:success] = "Successfully signed up, signed in as #{@user.username}"
      session[:user_id] = @user.id

      goto_return_url_or_root
    else
      render 'new'
    end
  end

  def profile
    @user = User.where(:id => params[:id]).first
    @page_title = "Profile for #{@user.display_name}"
  end

  def email_confirm
    @user = User.where(:email_confirmation_token => params[:token]).first

    if @user.blank?
      flash[:danger] = "Invalid email confirmation token"
      redirect_to(root_url)
      return
    end

    if @user.email_confirmed
      flash[:danger] = "Email address is already confirmed"
      redirect_to(root_url)
      return
    end

    @user.email_confirmed = true
    if @user.save
      flash[:success] = "Your email address has been confirmed"
      redirect_to(root_url)
    else
      flash[:danger] = "Something went wrong while trying to confirm your email address, please contact us at the forums"
      redirect_to(root_url)
    end
{'fraction_non_alphanumeric': 0.10562052055827989, 'fraction_numerical': 0.0, 'mean_word_length': 2.970059880239521, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4535410', 'n_tokens_mistral': 819, 'n_tokens_neox': 786, 'n_words': 218}