<commit_before>class User::RegistrationsController < Devise::RegistrationsController
  alias_method :authenticate_user!, :authenticate!

  before_action :authenticate!, only: :show

  before_action -> { check_root_for resource_name }, only: [:create, :update]

  def show
    render json: current_user, status: :ok
  end

  def create
    super do |user|
      return render_validation_errors(user) unless user.persisted?

      render json: user, status: :created and return
    end
  end

  def update
    super do |user|
      # If current_password is invalid, devise is not setting properly
      # the user (user.valid? will be true but errors will still appear in
      # user.errors).
      return render_validation_errors(user) if user.errors.present?

      render json: user, status: :ok and return
    end
  end

  def destroy
    super { head :no_content and return }
  end

  protected

  def sign_up_params<commit_msg>change error checker in registrations#update<commit_after>class User::RegistrationsController < Devise::RegistrationsController
  alias_method :authenticate_user!, :authenticate!

  before_action :authenticate!, only: :show

  before_action -> { check_root_for resource_name }, only: [:create, :update]

  def show
    render json: current_user, status: :ok
  end

  def create
    super do |user|
      return render_validation_errors(user) unless user.persisted?

      render json: user, status: :created and return
    end
  end

  def update
    super do |user|
      # If current_password is invalid, devise is not setting properly
      # the user (user.valid? will be true but errors will still appear in
      # user.errors).
      return render_validation_errors(user) unless user.errors.empty?

      render json: user, status: :ok and return
    end
  end

  def destroy
    super { head :no_content and return }
  end

  protected

  def sign_up_params
{'fraction_non_alphanumeric': 0.07116499736425935, 'fraction_numerical': 0.0, 'mean_word_length': 3.4658823529411764, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2551805', 'n_tokens_mistral': 565, 'n_tokens_neox': 532, 'n_words': 189}