<commit_before>module Glysellin
  module CartSteps
    class AddressesController < CartController
      def update
        if user_signed_in?
          current_cart.customer = current_user.customer
        end

        if current_cart.update_attributes(cart_params)
          current_cart.addresses_filled!
          redirect_to cart_path
        else
          current_cart.state = "addresses"
          render "glysellin/cart/show"
        end
      end

      private

      def cart_params
        cart_params = params.require(:cart).permit(
          :use_another_address_for_shipping,
          customer_attributes: [
            :id, :email, user_attributes: [
              :id, :password, :password_confirmation
            ]
          ],
          billing_address_attributes: address_params,
          shipping_address_attributes: address_params
        )

        assign_customer_names_params!(cart_params)
        assign_user_email_params!(cart_params)

        cart_params
      end

      def assign_customer_names_params!(cart_params)
        if cart_params[:customer_attributes] &&
          cart_params[:billing_address_attributes]<commit_msg>adds email to whiteattr<commit_after>module Glysellin
  module CartSteps
    class AddressesController < CartController
      def update
        if user_signed_in?
          current_cart.customer = current_user.customer
        end

        if current_cart.update_attributes(cart_params)
          current_cart.addresses_filled!
          redirect_to cart_path
        else
          current_cart.state = "addresses"
          render "glysellin/cart/show"
        end
      end

      private

      def cart_params
        cart_params = params.require(:cart).permit(
          :use_another_address_for_shipping,
          customer_attributes: [
            :id, :email, user_attributes: [
              :id, :email, :password, :password_<PASSWORD>
            ]
          ],
          billing_address_attributes: address_params,
          shipping_address_attributes: address_params
        )

        assign_customer_names_params!(cart_params)
        assign_user_email_params!(cart_params)

        cart_params
      end

      def assign_customer_names_params!(cart_params)
        if cart_params[:customer_attributes] &&
          cart_params[:billing_address_attributes]
{'fraction_non_alphanumeric': 0.059075342465753425, 'fraction_numerical': 0.0, 'mean_word_length': 2.2776998597475457, 'pattern_counts': {'":': 0, '<': 6, '<?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': '676038', 'n_tokens_mistral': 636, 'n_tokens_neox': 617, 'n_words': 107}