From dea1a28a698a2dd2618cd6a414918a4552ec1608 Mon Sep 17 00:00:00 2001 From: kikito Date: Thu, 21 Apr 2016 12:53:44 +0200 Subject: [PATCH] purges simple_captcha --- Gemfile | 1 - Gemfile.lock | 3 - README.md | 2 +- README_ES.md | 2 +- app/assets/stylesheets/layout.scss | 20 ------- app/assets/stylesheets/print.css | 2 - app/controllers/application_controller.rb | 1 - .../concerns/commentable_actions.rb | 4 +- app/controllers/debates_controller.rb | 2 +- .../management/proposals_controller.rb | 2 +- .../spending_proposals_controller.rb | 4 +- .../organizations/registrations_controller.rb | 4 +- app/controllers/proposals_controller.rb | 2 +- .../spending_proposals_controller.rb | 4 +- .../users/registrations_controller.rb | 5 +- app/models/debate.rb | 1 - app/models/proposal.rb | 1 - app/models/spending_proposal.rb | 1 - app/models/user.rb | 1 - app/views/debates/_form.html.erb | 4 -- .../organizations/registrations/new.html.erb | 3 - app/views/pages/faq.html.erb | 2 +- app/views/proposals/_form.html.erb | 4 -- app/views/simple_captcha/_simple_captcha.erb | 8 --- app/views/spending_proposals/_form.html.erb | 6 +- app/views/users/registrations/new.html.erb | 2 - config/deploy/shared/secrets.yml.erb | 2 - config/i18n-tasks.yml | 1 - config/initializers/simple_captcha.rb | 37 ------------ config/locales/en.yml | 9 --- config/locales/es.yml | 9 --- .../20160421090733_destroy_captcha_table.rb | 5 ++ db/schema.rb | 9 --- spec/controllers/debates_controller_spec.rb | 9 --- spec/features/debates_spec.rb | 48 ---------------- spec/features/management/proposals_spec.rb | 1 - .../management/spending_proposals_spec.rb | 3 +- spec/features/organizations_spec.rb | 1 - spec/features/proposals_spec.rb | 56 ------------------- spec/features/registration_form_spec.rb | 1 - spec/features/spending_proposals_spec.rb | 23 -------- spec/features/tags_spec.rb | 4 -- spec/features/users_auth_spec.rb | 1 - spec/support/common_actions.rb | 5 -- 44 files changed, 23 insertions(+), 292 deletions(-) delete mode 100644 app/views/simple_captcha/_simple_captcha.erb delete mode 100644 config/initializers/simple_captcha.rb create mode 100644 db/migrate/20160421090733_destroy_captcha_table.rb diff --git a/Gemfile b/Gemfile index 001eb4c38..7bfac1b15 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,6 @@ gem 'responders' gem 'foundation-rails' gem 'foundation_rails_helper' gem 'acts_as_votable' -gem 'simple_captcha2', require: 'simple_captcha' gem 'ckeditor', '~> 4.1.5' gem 'cancancan' gem 'social-share-button', git: 'https://github.com/huacnlee/social-share-button.git', ref: 'e46a6a3e82b86023bc' diff --git a/Gemfile.lock b/Gemfile.lock index 4e6b1aa80..8bc02c6ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,8 +365,6 @@ GEM nokogiri (>= 1.4.0) nori (~> 2.4) wasabi (~> 3.4) - simple_captcha2 (0.4.0) - rails (>= 4.1) simplecov (0.11.2) docile (~> 1.1.0) json (~> 1.8) @@ -492,7 +490,6 @@ DEPENDENCIES rspec-rails (~> 3.3) sass-rails (~> 5.0, >= 5.0.4) savon - simple_captcha2 social-share-button! spring spring-commands-rspec diff --git a/README.md b/README.md index e6181f38c..0ee254d3a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Frontend tools used include [SCSS](http://sass-lang.com/) over [Foundation](http ## Configuration for development and test environments -Prerequisites: install git, ImageMagick, Ruby 2.2.3, bundler gem, ghostscript and PostgreSQL (>=9.4). +Prerequisites: install git, Ruby 2.2.3, bundler gem, ghostscript and PostgreSQL (>=9.4). ``` git clone https://github.com/consul/consul.git diff --git a/README_ES.md b/README_ES.md index e0392bc51..9ae368848 100644 --- a/README_ES.md +++ b/README_ES.md @@ -27,7 +27,7 @@ Las herramientas utilizadas para el frontend no están cerradas aún. Los estilo ## Configuración para desarrollo y tests -Prerequisitos: tener instalado git, ImageMagick, Ruby 2.2.3, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior). +Prerequisitos: tener instalado git, Ruby 2.2.3, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior). ``` diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 475a0bfbe..030041769 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -746,26 +746,6 @@ form { line-height: $line-height; vertical-align: middle; } - - .captcha { - border: 0; - padding: $line-height/2 0; - - input { - margin-bottom: 0 !important; - } - } - - .button.margin-top { - margin-top: $line-height; - } -} - -.captcha { - - label { - display: none; - } } // 07. Alerts diff --git a/app/assets/stylesheets/print.css b/app/assets/stylesheets/print.css index 5297826c8..29096ae13 100644 --- a/app/assets/stylesheets/print.css +++ b/app/assets/stylesheets/print.css @@ -24,8 +24,6 @@ img.left { display: none !important; } .icon-proposals { display: none !important; } -.captcha { display: none !important; } - li.name { display: none !important; } li.kind { display: none !important; } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 640adf299..10a3c97b9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,6 @@ require "application_responder" class ApplicationController < ActionController::Base - include SimpleCaptcha::ControllerHelpers include HasFilters include HasOrders diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 332d031a5..de2a2276a 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -38,7 +38,7 @@ module CommentableActions @resource = resource_model.new(strong_params) @resource.author = current_user - if @resource.save_with_captcha + if @resource.save track_event redirect_path = url_for(controller: controller_name, action: :show, id: @resource.id) redirect_to redirect_path, notice: t("flash.actions.create.#{resource_name.underscore}") @@ -55,7 +55,7 @@ module CommentableActions def update resource.assign_attributes(strong_params) - if resource.save_with_captcha + if resource.save redirect_to resource, notice: t("flash.actions.update.#{resource_name.underscore}") else load_categories diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index b747cd903..40e198148 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -45,7 +45,7 @@ class DebatesController < ApplicationController private def debate_params - params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service, :captcha, :captcha_key) + params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service) end def resource_model diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb index 3f4284a06..7d3925e95 100644 --- a/app/controllers/management/proposals_controller.rb +++ b/app/controllers/management/proposals_controller.rb @@ -33,7 +33,7 @@ class Management::ProposalsController < Management::BaseController end def proposal_params - params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :captcha, :captcha_key) + params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service) end def resource_model diff --git a/app/controllers/management/spending_proposals_controller.rb b/app/controllers/management/spending_proposals_controller.rb index 49378ca63..ca723cccc 100644 --- a/app/controllers/management/spending_proposals_controller.rb +++ b/app/controllers/management/spending_proposals_controller.rb @@ -16,7 +16,7 @@ class Management::SpendingProposalsController < Management::BaseController @spending_proposal = SpendingProposal.new(spending_proposal_params) @spending_proposal.author = managed_user - if @spending_proposal.save_with_captcha + if @spending_proposal.save redirect_to management_spending_proposal_path(@spending_proposal), notice: t('flash.actions.create.notice', resource_name: t("activerecord.models.spending_proposal", count: 1)) else render :new @@ -45,7 +45,7 @@ class Management::SpendingProposalsController < Management::BaseController end def spending_proposal_params - params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :terms_of_service, :captcha, :captcha_key) + params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :terms_of_service) end def only_verified_users diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index c0f69da33..b0b177f09 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -11,7 +11,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController def create build_resource(sign_up_params) - if resource.valid_with_captcha? + if resource.valid? super do |user| # Removes unuseful "organization is invalid" error message user.errors.messages.delete(:organization) @@ -29,7 +29,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController private def sign_up_params - params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :captcha, :captcha_key, :terms_of_service, organization_attributes: [:name, :responsible_name]) + params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :terms_of_service, organization_attributes: [:name, :responsible_name]) end end diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 8567cda14..9153df449 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -56,7 +56,7 @@ class ProposalsController < ApplicationController private def proposal_params - params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :captcha, :captcha_key, :geozone_id) + params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :geozone_id) end def retired_params diff --git a/app/controllers/spending_proposals_controller.rb b/app/controllers/spending_proposals_controller.rb index 9915b0b50..64172ed56 100644 --- a/app/controllers/spending_proposals_controller.rb +++ b/app/controllers/spending_proposals_controller.rb @@ -27,7 +27,7 @@ class SpendingProposalsController < ApplicationController @spending_proposal = SpendingProposal.new(spending_proposal_params) @spending_proposal.author = current_user - if @spending_proposal.save_with_captcha + if @spending_proposal.save notice = t('flash.actions.create.spending_proposal', activity: "#{t('layouts.header.my_activity_link')}") redirect_to @spending_proposal, notice: notice, flash: { html_safe: true } else @@ -49,7 +49,7 @@ class SpendingProposalsController < ApplicationController private def spending_proposal_params - params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name, :terms_of_service, :captcha, :captcha_key) + params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name, :terms_of_service) end def set_geozone_name diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 9d6530017..da9fc1372 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -9,7 +9,7 @@ class Users::RegistrationsController < Devise::RegistrationsController def create build_resource(sign_up_params) - if resource.valid_with_captcha? + if resource.valid? super else render :new @@ -58,8 +58,7 @@ class Users::RegistrationsController < Devise::RegistrationsController def sign_up_params params[:user].delete(:redeemable_code) if params[:user].present? && params[:user][:redeemable_code].blank? params.require(:user).permit(:username, :email, :password, - :password_confirmation, :captcha, - :captcha_key, :terms_of_service, :locale, + :password_confirmation, :terms_of_service, :locale, :redeemable_code) end diff --git a/app/models/debate.rb b/app/models/debate.rb index cdae527f7..840b9c4b5 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -8,7 +8,6 @@ class Debate < ActiveRecord::Base include Searchable include Filterable - apply_simple_captcha acts_as_votable acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/proposal.rb b/app/models/proposal.rb index e6071e052..d2b97f1c5 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -7,7 +7,6 @@ class Proposal < ActiveRecord::Base include Searchable include Filterable - apply_simple_captcha acts_as_votable acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/spending_proposal.rb b/app/models/spending_proposal.rb index 3a13935c4..a2c143336 100644 --- a/app/models/spending_proposal.rb +++ b/app/models/spending_proposal.rb @@ -4,7 +4,6 @@ class SpendingProposal < ActiveRecord::Base include Taggable include Searchable - apply_simple_captcha acts_as_votable belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' diff --git a/app/models/user.rb b/app/models/user.rb index ea889ac57..7da80b6fb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,6 @@ class User < ActiveRecord::Base include Verification - apply_simple_captcha devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb index be5c92306..2e19b5d2b 100644 --- a/app/views/debates/_form.html.erb +++ b/app/views/debates/_form.html.erb @@ -32,10 +32,6 @@ <% end %> -
- <%= f.simple_captcha input_html: { required: false } %> -
-
<%= f.submit(class: "button", value: t("debates.#{action_name}.form.submit_button")) %>
diff --git a/app/views/organizations/registrations/new.html.erb b/app/views/organizations/registrations/new.html.erb index 8d39d0199..01483fda5 100644 --- a/app/views/organizations/registrations/new.html.erb +++ b/app/views/organizations/registrations/new.html.erb @@ -24,9 +24,6 @@ label: t("devise_views.organizations.registrations.new.password_confirmation_label"), placeholder: t("devise_views.organizations.registrations.new.password_confirmation_label") %> - <%= f.simple_captcha input_html: {required: false} %> - - <%= f.label :terms_of_service do %> <%= f.check_box :terms_of_service, title: t('devise_views.users.registrations.new.terms_title'), label: false %> diff --git a/app/views/pages/faq.html.erb b/app/views/pages/faq.html.erb index 0dcd09a68..7f82147b6 100644 --- a/app/views/pages/faq.html.erb +++ b/app/views/pages/faq.html.erb @@ -71,7 +71,7 @@

¿Cómo creo y verifico mi cuenta?

diff --git a/app/views/proposals/_form.html.erb b/app/views/proposals/_form.html.erb index 4762e309e..4b37ae554 100644 --- a/app/views/proposals/_form.html.erb +++ b/app/views/proposals/_form.html.erb @@ -84,10 +84,6 @@ <% end %> -
- <%= f.simple_captcha input_html: { required: false } %> -
-
<%= f.submit(class: "button", value: t("proposals.#{action_name}.form.submit_button")) %>
diff --git a/app/views/simple_captcha/_simple_captcha.erb b/app/views/simple_captcha/_simple_captcha.erb deleted file mode 100644 index 5f57da6fc..000000000 --- a/app/views/simple_captcha/_simple_captcha.erb +++ /dev/null @@ -1,8 +0,0 @@ -
- <%= simple_captcha_options[:image] %> - <%= simple_captcha_options[:refresh_button] %> - -

<%= simple_captcha_options[:label] %>

- - <%= simple_captcha_options[:field] %> -
diff --git a/app/views/spending_proposals/_form.html.erb b/app/views/spending_proposals/_form.html.erb index 0d6ef0402..083d04861 100644 --- a/app/views/spending_proposals/_form.html.erb +++ b/app/views/spending_proposals/_form.html.erb @@ -40,12 +40,8 @@ <% end %> -
- <%= f.simple_captcha input_html: { required: false } %> -
-
<%= f.submit(class: "button", value: t("spending_proposals.form.submit_buttons.#{action_name}")) %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index c810ea067..fa9d71118 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -35,8 +35,6 @@ <%= f.text_field :redeemable_code, placeholder: t("devise_views.users.registrations.new.redeemable_code") %> <% end %> - <%= f.simple_captcha input_html: {required: false} %> - <%= f.label :terms_of_service do %> <%= f.check_box :terms_of_service, title: t('devise_views.users.registrations.new.terms_title'), label: false %> diff --git a/config/deploy/shared/secrets.yml.erb b/config/deploy/shared/secrets.yml.erb index 42a8c48a6..8f82c5dca 100644 --- a/config/deploy/shared/secrets.yml.erb +++ b/config/deploy/shared/secrets.yml.erb @@ -1,6 +1,4 @@ <%= fetch(:rails_env) %>: - recaptcha_public_key: <%= ENV["MADRID_RECAPTCHA_PUBLIC_KEY"] %> - recaptcha_private_key: <%= ENV["MADRID_RECAPTCHA_PRIVATE_KEY"] %> secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> twitter_key: <%= ENV["TWITTER_KEY"] %> twitter_secret: <%= ENV["TWITTER_SECRET"] %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 40086aab9..0d7539eee 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -105,7 +105,6 @@ ignore_unused: - 'activerecord.*' - 'activemodel.*' - 'unauthorized.*' - - 'simple_captcha.*' - 'admin.officials.level_*' - 'admin.comments.index.filter*' - 'admin.debates.index.filter*' diff --git a/config/initializers/simple_captcha.rb b/config/initializers/simple_captcha.rb deleted file mode 100644 index 2ac5826c3..000000000 --- a/config/initializers/simple_captcha.rb +++ /dev/null @@ -1,37 +0,0 @@ -SimpleCaptcha.always_pass = false - -SimpleCaptcha.setup do |sc| - # default: 100x28 - sc.image_size = '120x40' - - # default: 5 - sc.length = 6 - - # default: simply_blue - # possible values: - # 'embosed_silver', - # 'simply_red', - # 'simply_green', - # 'simply_blue', - # 'distorted_black', - # 'all_black', - # 'charcoal_grey', - # 'almost_invisible' - # 'random' - sc.image_style = 'simply_green' - - # default: low - # possible values: 'low', 'medium', 'high', 'random' - sc.distortion = 'random' - - # default: medium - # possible values: 'none', 'low', 'medium', 'high' - sc.implode = 'medium' - - # sc.image_style = 'mycaptha' - # sc.add_image_style('mycaptha', [ - # "-background '#F4F7F8'", - # "-fill '#86818B'", - # "-border 1", - # "-bordercolor '#E0E2E3'"]) -end diff --git a/config/locales/en.yml b/config/locales/en.yml index de37b5975..f3002983b 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -417,15 +417,6 @@ en: categories: "Categories" target_blank_html: " (link opens in new window)" unflag: Unflag - simple_captcha: - label: Enter the text from the image in the box below - message: - debate: the secret code does not match the image - proposal: the secret code does not match the image - spendingproposal: the secret code does not match the image - user: the secret code does not match the image - placeholder: Enter the text from the image - refresh_button_text: Refresh social: blog: Blog facebook: Facebook diff --git a/config/locales/es.yml b/config/locales/es.yml index d2d01e407..dfd00b2f0 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -417,15 +417,6 @@ es: categories: "Categorías" target_blank_html: " (se abre en ventana nueva)" unflag: Deshacer denuncia - simple_captcha: - label: Introduce el texto de la imagen en la siguiente caja - message: - debate: el código secreto no coincide con la imagen - proposal: el código secreto no coincide con la imagen - spendingproposal: el código secreto no coincide con la imagen - user: el código secreto no coincide con la imagen - placeholder: Introduce el texto de la imagen - refresh_button_text: Refrescar social: blog: Blog facebook: Facebook diff --git a/db/migrate/20160421090733_destroy_captcha_table.rb b/db/migrate/20160421090733_destroy_captcha_table.rb new file mode 100644 index 000000000..68d045d2f --- /dev/null +++ b/db/migrate/20160421090733_destroy_captcha_table.rb @@ -0,0 +1,5 @@ +class DestroyCaptchaTable < ActiveRecord::Migration + def change + drop_table :simple_captcha_data + end +end diff --git a/db/schema.rb b/db/schema.rb index 55641228c..b105a2b2c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -286,15 +286,6 @@ ActiveRecord::Schema.define(version: 20160426211658) do add_index "settings", ["key"], name: "index_settings_on_key", using: :btree - create_table "simple_captcha_data", force: :cascade do |t| - t.string "key", limit: 40 - t.string "value", limit: 6 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "simple_captcha_data", ["key"], name: "idx_key", using: :btree - create_table "spending_proposals", force: :cascade do |t| t.string "title" t.text "description" diff --git a/spec/controllers/debates_controller_spec.rb b/spec/controllers/debates_controller_spec.rb index 85bf9bd1c..12dc0fe40 100644 --- a/spec/controllers/debates_controller_spec.rb +++ b/spec/controllers/debates_controller_spec.rb @@ -2,15 +2,6 @@ require 'rails_helper' describe DebatesController do - before(:all) do - @original_captcha_pass_value = SimpleCaptcha.always_pass - SimpleCaptcha.always_pass = true - end - - after(:all) do - SimpleCaptcha.always_pass = @original_captcha_pass_value - end - describe 'POST create' do it 'should create an ahoy event' do diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 5efb48406..03e794d74 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -96,7 +96,6 @@ feature 'Debates' do visit new_debate_path fill_in 'debate_title', with: 'A title for a debate' fill_in 'debate_description', with: 'This is very important because...' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' click_button 'Start a debate' @@ -108,26 +107,6 @@ feature 'Debates' do expect(page).to have_content I18n.l(Debate.last.created_at.to_date) end - scenario 'Captcha is required for debate creation' do - login_as(create(:user)) - - visit new_debate_path - fill_in 'debate_title', with: "Great title" - fill_in 'debate_description', with: 'Very important issue...' - fill_in 'debate_captcha', with: "wrongText!" - check 'debate_terms_of_service' - - click_button "Start a debate" - - expect(page).to_not have_content "Debate created successfully." - expect(page).to have_content "1 error" - - fill_in 'debate_captcha', with: correct_captcha_text - click_button "Start a debate" - - expect(page).to have_content "Debate created successfully." - end - scenario 'Errors on create' do author = create(:user) login_as(author) @@ -144,7 +123,6 @@ feature 'Debates' do visit new_debate_path fill_in 'debate_title', with: 'Testing an attack' fill_in 'debate_description', with: '

This is

' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' click_button 'Start a debate' @@ -163,7 +141,6 @@ feature 'Debates' do visit new_debate_path fill_in 'debate_title', with: 'Testing auto link' fill_in 'debate_description', with: '

This is a link www.example.org

' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' click_button 'Start a debate' @@ -180,7 +157,6 @@ feature 'Debates' do visit new_debate_path fill_in 'debate_title', with: 'Testing auto link' fill_in 'debate_description', with: " click me http://example.org" - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' click_button 'Start a debate' @@ -213,7 +189,6 @@ feature 'Debates' do fill_in 'debate_title', with: 'Testing auto link' fill_in 'debate_description', with: " click me http://example.org" - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' find('.js-add-tag-link', text: 'Education').click @@ -232,7 +207,6 @@ feature 'Debates' do fill_in 'debate_title', with: "Great title" fill_in 'debate_description', with: 'Very important issue...' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' fill_in 'debate_tag_list', with: 'Refugees, Solidarity' @@ -250,7 +224,6 @@ feature 'Debates' do fill_in 'debate_title', with: 'A test of dangerous strings' fill_in 'debate_description', with: 'A description suitable for this test' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' fill_in 'debate_tag_list', with: 'user_id=1, &a=3, ' @@ -300,7 +273,6 @@ feature 'Debates' do fill_in 'debate_title', with: "End child poverty" fill_in 'debate_description', with: "Let's do something to end child poverty" - fill_in 'debate_captcha', with: correct_captcha_text click_button "Save changes" @@ -320,26 +292,6 @@ feature 'Debates' do expect(page).to have_content error_message end - scenario 'Captcha is required to update a debate' do - debate = create(:debate) - login_as(debate.author) - - visit edit_debate_path(debate) - expect(current_path).to eq(edit_debate_path(debate)) - - fill_in 'debate_title', with: "New title" - fill_in 'debate_captcha', with: "wrong!" - click_button "Save changes" - - expect(page).to_not have_content "Debate updated successfully." - expect(page).to have_content "error" - - fill_in 'debate_captcha', with: correct_captcha_text - click_button "Save changes" - - expect(page).to have_content "Debate updated successfully." - end - describe 'Limiting tags shown' do scenario 'Index page shows up to 5 tags per debate' do tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] diff --git a/spec/features/management/proposals_spec.rb b/spec/features/management/proposals_spec.rb index e5279bac4..744a8fe0b 100644 --- a/spec/features/management/proposals_spec.rb +++ b/spec/features/management/proposals_spec.rb @@ -27,7 +27,6 @@ feature 'Proposals' do fill_in 'proposal_description', with: 'This is very important because...' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' diff --git a/spec/features/management/spending_proposals_spec.rb b/spec/features/management/spending_proposals_spec.rb index 760d2a07a..2c20ee684 100644 --- a/spec/features/management/spending_proposals_spec.rb +++ b/spec/features/management/spending_proposals_spec.rb @@ -24,7 +24,6 @@ feature 'Spending Proposals' do fill_in 'spending_proposal_title', with: 'Build a park in my neighborhood' fill_in 'spending_proposal_description', with: 'There is no parks here...' fill_in 'spending_proposal_external_url', with: 'http://moarparks.com' - fill_in 'spending_proposal_captcha', with: correct_captcha_text check 'spending_proposal_terms_of_service' click_button 'Create' @@ -221,4 +220,4 @@ feature 'Spending Proposals' do end -end \ No newline at end of file +end diff --git a/spec/features/organizations_spec.rb b/spec/features/organizations_spec.rb index 052b3bae5..343f31228 100644 --- a/spec/features/organizations_spec.rb +++ b/spec/features/organizations_spec.rb @@ -13,7 +13,6 @@ feature 'Organizations' do fill_in 'user_email', with: 'green@peace.com' fill_in 'user_password', with: 'greenpeace' fill_in 'user_password_confirmation', with: 'greenpeace' - fill_in 'user_captcha', with: correct_captcha_text check 'user_terms_of_service' click_button 'Register' diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 4a3ea58a1..c2d8c5aaf 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -130,7 +130,6 @@ feature 'Proposals' do fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -157,7 +156,6 @@ feature 'Proposals' do fill_in 'proposal_description', with: 'This is very important because...' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text fill_in 'proposal_responsible_name', with: 'Isabel Garcia' check 'proposal_terms_of_service' @@ -179,7 +177,6 @@ feature 'Proposals' do fill_in 'proposal_summary', with: 'In summary, what we want is...' fill_in 'proposal_description', with: 'This is very important because...' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -187,30 +184,6 @@ feature 'Proposals' do expect(page).to have_content 'Proposal created successfully.' end - scenario 'Captcha is required for proposal creation' do - login_as(create(:user)) - - visit new_proposal_path - fill_in 'proposal_title', with: "Great title" - fill_in 'proposal_question', with: '¿Would you like to give assistance to war refugees?' - fill_in 'proposal_summary', with: 'In summary, what we want is...' - fill_in 'proposal_description', with: 'Very important issue...' - fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' - fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: "wrongText!" - check 'proposal_terms_of_service' - - click_button "Create proposal" - - expect(page).to_not have_content "Proposal created successfully." - expect(page).to have_content "1 error" - - fill_in 'proposal_captcha', with: correct_captcha_text - click_button "Create proposal" - - expect(page).to have_content "Proposal created successfully." - end - scenario 'Errors on create' do author = create(:user) login_as(author) @@ -231,7 +204,6 @@ feature 'Proposals' do fill_in 'proposal_description', with: '

This is

' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -253,7 +225,6 @@ feature 'Proposals' do fill_in 'proposal_summary', with: 'In summary, what we want is...' fill_in 'proposal_description', with: '

This is a link www.example.org

' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -273,7 +244,6 @@ feature 'Proposals' do fill_in 'proposal_summary', with: 'In summary, what we want is...' fill_in 'proposal_description', with: "
click me http://example.org" fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -311,7 +281,6 @@ feature 'Proposals' do fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' find('.js-add-tag-link', text: 'Education').click @@ -335,7 +304,6 @@ feature 'Proposals' do fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' fill_in 'proposal_tag_list', with: 'Refugees, Solidarity' @@ -360,7 +328,6 @@ feature 'Proposals' do fill_in 'proposal_description', with: 'A description suitable for this test' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' fill_in 'proposal_tag_list', with: 'user_id=1, &a=3, ' @@ -390,7 +357,6 @@ feature 'Proposals' do fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' click_button 'Create proposal' @@ -416,7 +382,6 @@ feature 'Proposals' do fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_video_url', with: 'http://youtube.com' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text check 'proposal_terms_of_service' select('California', from: 'proposal_geozone_id') @@ -563,7 +528,6 @@ feature 'Proposals' do fill_in 'proposal_description', with: "Let's do something to end child poverty" fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_responsible_name', with: 'Isabel Garcia' - fill_in 'proposal_captcha', with: correct_captcha_text click_button "Save changes" @@ -584,26 +548,6 @@ feature 'Proposals' do expect(page).to have_content error_message end - scenario 'Captcha is required to update a proposal' do - proposal = create(:proposal) - login_as(proposal.author) - - visit edit_proposal_path(proposal) - expect(current_path).to eq(edit_proposal_path(proposal)) - - fill_in 'proposal_title', with: "New cool title" - fill_in 'proposal_captcha', with: "wrong!" - click_button "Save changes" - - expect(page).to_not have_content "Proposal updated successfully." - expect(page).to have_content "error" - - fill_in 'proposal_captcha', with: correct_captcha_text - click_button "Save changes" - - expect(page).to have_content "Proposal updated successfully." - end - describe 'Limiting tags shown' do scenario 'Index page shows up to 5 tags per proposal' do create_featured_proposals diff --git a/spec/features/registration_form_spec.rb b/spec/features/registration_form_spec.rb index 6439ac726..b14b200a0 100644 --- a/spec/features/registration_form_spec.rb +++ b/spec/features/registration_form_spec.rb @@ -32,7 +32,6 @@ feature 'Registration form' do fill_in 'user_password', with: "password" fill_in 'user_password_confirmation', with: "password" fill_in 'user_redeemable_code', with: " " - fill_in 'user_captcha', with: correct_captcha_text check 'user_terms_of_service' click_button 'Register' diff --git a/spec/features/spending_proposals_spec.rb b/spec/features/spending_proposals_spec.rb index cb3a6d8d5..dbfdfdf34 100644 --- a/spec/features/spending_proposals_spec.rb +++ b/spec/features/spending_proposals_spec.rb @@ -97,7 +97,6 @@ feature 'Spending proposals' do fill_in 'spending_proposal_description', with: 'I want to live in a high tower over the clouds' fill_in 'spending_proposal_external_url', with: 'http://http://skyscraperpage.com/' fill_in 'spending_proposal_association_name', with: 'People of the neighbourhood' - fill_in 'spending_proposal_captcha', with: correct_captcha_text select 'All city', from: 'spending_proposal_geozone_id' check 'spending_proposal_terms_of_service' @@ -119,7 +118,6 @@ feature 'Spending proposals' do fill_in 'spending_proposal_description', with: 'I want to live in a high tower over the clouds' fill_in 'spending_proposal_external_url', with: 'http://http://skyscraperpage.com/' fill_in 'spending_proposal_association_name', with: 'People of the neighbourhood' - fill_in 'spending_proposal_captcha', with: correct_captcha_text select 'All city', from: 'spending_proposal_geozone_id' check 'spending_proposal_terms_of_service' @@ -137,27 +135,6 @@ feature 'Spending proposals' do expect(page).to have_content "Build a skyscraper" end - scenario 'Captcha is required for proposal creation' do - login_as(author) - - visit new_spending_proposal_path - fill_in 'spending_proposal_title', with: 'Build a skyscraper' - fill_in 'spending_proposal_description', with: 'I want to live in a high tower over the clouds' - fill_in 'spending_proposal_external_url', with: 'http://http://skyscraperpage.com/' - fill_in 'spending_proposal_captcha', with: 'wrongText' - check 'spending_proposal_terms_of_service' - - click_button 'Create' - - expect(page).to_not have_content 'Spending proposal created successfully' - expect(page).to have_content '1 error' - - fill_in 'spending_proposal_captcha', with: correct_captcha_text - click_button 'Create' - - expect(page).to have_content 'Spending proposal created successfully' - end - scenario 'Errors on create' do login_as(author) diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb index a67f412a3..7ac81c139 100644 --- a/spec/features/tags_spec.rb +++ b/spec/features/tags_spec.rb @@ -61,7 +61,6 @@ feature 'Tags' do visit new_debate_path fill_in 'debate_title', with: 'Title' fill_in 'debate_description', with: 'Description' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' fill_in 'debate_tag_list', with: "Impuestos, Economía, Hacienda" @@ -81,7 +80,6 @@ feature 'Tags' do visit new_debate_path fill_in 'debate_title', with: 'Title' fill_in 'debate_description', with: 'Description' - fill_in 'debate_captcha', with: correct_captcha_text check 'debate_terms_of_service' fill_in 'debate_tag_list', with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" @@ -101,7 +99,6 @@ feature 'Tags' do expect(page).to have_selector("input[value='Economía']") fill_in 'debate_tag_list', with: "Economía, Hacienda" - fill_in 'debate_captcha', with: correct_captcha_text click_button 'Save changes' expect(page).to have_content 'Debate updated successfully.' @@ -118,7 +115,6 @@ feature 'Tags' do visit edit_debate_path(debate) fill_in 'debate_tag_list', with: "" - fill_in 'debate_captcha', with: correct_captcha_text click_button 'Save changes' expect(page).to have_content 'Debate updated successfully.' diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index f9b92bb12..bd93a04f8 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -11,7 +11,6 @@ feature 'Users' do fill_in 'user_email', with: 'manuela@madrid.es' fill_in 'user_password', with: 'judgementday' fill_in 'user_password_confirmation', with: 'judgementday' - fill_in 'user_captcha', with: correct_captcha_text check 'user_terms_of_service' click_button 'Register' diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 340d7c8a7..bba79441b 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -9,7 +9,6 @@ module CommonActions fill_in 'user_email', with: email fill_in 'user_password', with: password fill_in 'user_password_confirmation', with: password - fill_in 'user_captcha', with: correct_captcha_text check 'user_terms_of_service' click_button 'Register' @@ -86,10 +85,6 @@ module CommonActions expect(page).to have_content 'It will be done next week.' end - def correct_captcha_text - SimpleCaptcha::SimpleCaptchaData.last.value - end - def avatar(name) "img.initialjs-avatar[data-name='#{name}']" end