<commit_before>class Pasteque::V5::UsersController < Pasteque::V5::BaseController
  manage_restfully only: [:index, :show]

  def update_password
    @user = User.find(params[:id])
    password = permitted_params[:newPwd]
    render json: @user.update(password: password)
  end
end<commit_msg>implements Pasteque UserAPI#update_password properly<commit_after>class Pasteque::V5::UsersController < Pasteque::V5::BaseController
  manage_restfully only: [:index, :show]

  def update_password
    user = User.find_for_authentication(email: params[:user])
    old_password = params[:oldPwd]
    new_password = params[:newPwd]
    if user and user.valid_password?(old_password)
      user.password = <PASSWORD>
      user.password_confirmation = <PASSWORD>
      render json: user.save
    else
      render json: false
    end
  end
end
{'fraction_non_alphanumeric': 0.10336538461538461, 'fraction_numerical': 0.004807692307692308, 'mean_word_length': 4.744827586206896, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1452493', 'n_tokens_mistral': 262, 'n_tokens_neox': 260, 'n_words': 55}