<commit_before>class Api::UsersController < Api::ApiController

  def update
    user = current_user
    p = update_password_params
    if p.size > 0
      errors = {}
      user.update_password p[:old_password], p[:password], p[:password_confirmation]
      if user.errors.any? || !user.valid?
        render status: 401, json: {error: user.errors}
        return
      end
    else<commit_msg>Fix password update<commit_after>class Api::UsersController < Api::ApiController

  def update
    user = current_user
    p = update_password_params
    if p[:password] && p[:password_confirmation] && p[:old_password]
      errors = {}
      user.update_password p[:old_password], p[:password], p[:password_confirmation]
      if user.errors.any? || !user.valid?
        render status: 401, json: {error: user.errors}
        return
      else
        user.save
      end
    else
{'fraction_non_alphanumeric': 0.1095890410958904, 'fraction_numerical': 0.007990867579908675, 'mean_word_length': 2.9683257918552037, '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': '4110036', 'n_tokens_mistral': 264, 'n_tokens_neox': 258, 'n_words': 62}