<commit_before>class UsersController < ApplicationController
  def new
  	@user = User.new
  end

  def create
  	@user = User.new(permitted_params)
  	if @user.save
      sign_in @user
  		flash[:success] = "Welcome to Webboard!"
  		redirect_to @user
  	else
  		render 'new'
  	end
  end

  def index
  end

  def edit
    @user = User.find(params[:id])
    if current_user != @user
      flash[:danger] = "Nice try nub"
      redirect_to @user
    end
  end

  def update
    @user = User.find(params[:id])
    if @user.update_attributes(permitted_params)
      flash[:success] = "User information updated"
      redirect_to @user
    else
      render 'edit'
    end
  end
<commit_msg>Security for editing user information<commit_after>class UsersController < ApplicationController
  def new
  	@user = User.new
  end

  def create
  	@user = User.new(permitted_params)
  	if @user.save
      sign_in @user
  		flash[:success] = "Welcome to Webboard!"
  		redirect_to @user
  	else
  		render 'new'
  	end
  end

  def index
  end

  def edit
    @user = User.find(params[:id])
    if current_user != @user
      flash[:danger] = "Access denied"
      redirect_to @user
    end
  end

  def update
    @user = User.find(params[:id])
    if current_user != @user
      flash[:danger] = "Access denied"
      redirect_to @user
    else
      if @user.update_attributes(permitted_params)
        flash[:success] = "User information updated"
        redirect_to @user
      else
        render 'edit'
      end
    end
  end

{'fraction_non_alphanumeric': 0.09043250327653997, 'fraction_numerical': 0.0, 'mean_word_length': 2.5022935779816513, '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': '7372617', 'n_tokens_mistral': 518, 'n_tokens_neox': 501, 'n_words': 137}