<commit_before>require_dependency "ajo_contact/application_controller"

module AjoContact
  class ContactController < ApplicationController
    before_filter :force_non_ssl, :only => :index

    def force_non_ssl
      if request.ssl? && Rails.env.production?
        redirect_to :protocol => 'http://', :status => :moved_permanently
      end
    end
    layout 'application'
    def index
      @message = Message.new
    end

    def create
      @message = Message.new(params[:message])
      @message.user_agent = request.env["HTTP_USER_AGENT"]
      @message.source = 'microsite'
      if !verify_recaptcha
        flash.delete :recaptcha_error
        @message.valid?
        @message.errors.add(:recaptcha, "* Please try again")
        render :action => :index
      else
        if @message.save
          @email = AjoContact::ContactMailer.contact_email(@message.email_address, @message.subject, @message.message, '<EMAIL>').deliver
          @email.deliver
          redirect_to contact_thank_you_path
        else
          render :action => :index
        end<commit_msg>message<commit_after>require_dependency "ajo_contact/application_controller"

module AjoContact
  class ContactController < ApplicationController
    before_filter :force_non_ssl, :only => :index

    def force_non_ssl
      if request.ssl? && Rails.env.production?
        redirect_to :protocol => 'http://', :status => :moved_permanently
      end
    end
    layout 'application'
    def index
      @message = Message.new
    end

    def create
      @message = Message.new(params[:message])
      @message.user_agent = request.env["HTTP_USER_AGENT"]
      @message.source = 'microsite'
      if !verify_recaptcha
        flash.delete :recaptcha_error
        @message.valid?
        @message.errors.add(:recaptcha, "* Please try again")
        render :action => :index
      else
        if @message.save
          @email = AjoContact::ContactMailer.contact_email(@message.email_address, @message.subject, @message, '<EMAIL>').deliver
          @email.deliver
          redirect_to contact_thank_you_path
        else
          render :action => :index
        end
{'fraction_non_alphanumeric': 0.09972170686456401, 'fraction_numerical': 0.0, 'mean_word_length': 2.7842105263157895, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '247847', 'n_tokens_mistral': 623, 'n_tokens_neox': 610, 'n_words': 131}