recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

Recaptcha::RecaptchaError in Thredded::PostsController#create

Open fagianijunior opened this issue 6 years ago • 1 comments

If the user don't check the reCaptcha, show this error: Recaptcha::RecaptchaError in Thredded::PostsController#create captura de tela 2018-04-20 as 10 07 39

I am using the thredded gem forum.

in my GemFile

ruby '2.4.1'
gem 'rails', '~> 5.2.0'
gem "recaptcha", require: "recaptcha/rails"
gem 'thredded'

In view

<%= recaptcha_tags %>

In controller

    def create
      @post_form = Thredded::PostForm.new(
        user: thredded_current_user, topic: parent_topic, post_params: new_post_params
      )
      authorize_creating @post_form.post

      if verify_recaptcha(model: @post_form) && @post_form.save
        redirect_to post_path(@post_form.post, user: thredded_current_user)
      else
        render :new
      end
    end

fagianijunior avatar Apr 20 '18 13:04 fagianijunior

it things it's an AR object and tries to add errors ... needs a PR to make it check errors exists

grosser avatar Apr 20 '18 18:04 grosser