<commit_before># frozen_string_literal: true
require_dependency "decidim/application_controller"

module Decidim
  # This controller allows the user to accept the cookie policy.
  class CookiePolicyController < ApplicationController
    skip_authorization_check

    def accept
      response.set_cookie "decidim-cc", value: "true",
                                        path: "/",
                                        expires: 1.year.from_now.utc
    end
  end
end
<commit_msg>Fix errors when accepting cookies without JS enabled (#1067)<commit_after># frozen_string_literal: true
require_dependency "decidim/application_controller"

module Decidim
  # This controller allows the user to accept the cookie policy.
  class CookiePolicyController < ApplicationController
    skip_authorization_check

    def accept
      response.set_cookie "decidim-cc", value: "true",
                                        path: "/",
                                        expires: 1.year.from_now.utc

      respond_to do |format|
        format.js
        format.html { redirect_back fallback_location: root_path }
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05975395430579965, 'fraction_numerical': 0.005272407732864675, 'mean_word_length': 2.245014245014245, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6100251', 'n_tokens_mistral': 293, 'n_tokens_neox': 277, 'n_words': 83}