diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 0d21d9f..53ddfd5 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -358,7 +358,7 @@ class CmsController < MyProfileController @task.user_agent = request.user_agent @task.referrer = request.referrer @task.requestor = current_person if logged_in? - if verify_recaptcha(:model => @task, :message => _('Please type the words correctly')) && @task.save + if (logged_in? || verify_recaptcha(:model => @task, :message => _('Please type the words correctly'))) && @task.save session[:notice] = _('Thanks for your suggestion. The community administrators were notified.') redirect_to @back_to end diff --git a/app/views/cms/suggest_an_article.html.erb b/app/views/cms/suggest_an_article.html.erb index 14ea5dd..2307cb9 100644 --- a/app/views/cms/suggest_an_article.html.erb +++ b/app/views/cms/suggest_an_article.html.erb @@ -21,7 +21,7 @@ <%= hidden_field_tag('back_to', @back_to) %> - <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %> + <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) unless logged_in? %> <% button_bar do %> <%= submit_button :save, _('Save') %> diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 7f86a79..4b459a7 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -1422,6 +1422,19 @@ class CmsControllerTest < ActionController::TestCase assert_select '#task_email', 0 end + should 'display captcha when suggest an article for not logged in users' do + logout + get :suggest_an_article, :profile => profile.identifier, :back_to => 'action_view' + + assert_select '#dynamic_recaptcha' + end + + should 'not display captcha when suggest an article for logged in users' do + get :suggest_an_article, :profile => profile.identifier, :back_to => 'action_view' + + assert_select '#dynamic_recaptcha', 0 + end + should 'render TinyMce Editor on suggestion of article' do logout get :suggest_an_article, :profile => profile.identifier -- libgit2 0.21.2