purges simple_captcha
This commit is contained in:
1
Gemfile
1
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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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).
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "application_responder"
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include SimpleCaptcha::ControllerHelpers
|
||||
include HasFilters
|
||||
include HasOrders
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: "<a href='#{user_path(current_user, filter: :spending_proposals)}'>#{t('layouts.header.my_activity_link')}</a>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -2,7 +2,6 @@ class User < ActiveRecord::Base
|
||||
|
||||
include Verification
|
||||
|
||||
apply_simple_captcha
|
||||
devise :database_authenticatable, :registerable, :confirmable,
|
||||
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.simple_captcha input_html: { required: false } %>
|
||||
</div>
|
||||
|
||||
<div class="actions small-12 column">
|
||||
<%= f.submit(class: "button", value: t("debates.#{action_name}.form.submit_button")) %>
|
||||
</div>
|
||||
|
||||
@@ -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 %>
|
||||
<span class="checkbox">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<h2 id="5">¿Cómo creo y verifico mi cuenta?</h2>
|
||||
<ul>
|
||||
<li>Lo primero es crear una cuenta básica. Para ello hacemos clic en el enlace <a href="https://decide.madrid.es/users/sign_up">Registrarse</a> y rellenamos los datos que nos piden. Es un requisito marcar la casilla de aceptación de las condiciones de uso, y rellenar correctamente el captcha (en la parte inferior del formulario se nos presenta una imagen con unas letras deformadas que tendremos que introducir en la casilla inferior como medida de seguridad; ten en cuenta la diferencia entre mayúsculas y minúsculas). Al crear una cuenta nos llegará un correo electrónico a la dirección que hayamos especificado, y tendremos que hacer click en el enlace que contiene (el enlace que pone "Confirmar mi cuenta") para terminar de crear la cuenta.</li>
|
||||
<li>Lo primero es crear una cuenta básica. Para ello hacemos clic en el enlace <a href="https://decide.madrid.es/users/sign_up">Registrarse</a> y rellenamos los datos que nos piden. Es un requisito marcar la casilla de aceptación de las condiciones de uso. Al crear una cuenta nos llegará un correo electrónico a la dirección que hayamos especificado, y tendremos que hacer click en el enlace que contiene (el enlace que pone "Confirmar mi cuenta") para terminar de crear la cuenta.</li>
|
||||
<li>Una vez creada la cuenta básica, y tras <a href="https://decide.madrid.es/users/sign_in">entrar</a> con nuestro correo y contraseña, el sistema nos dará la opción de realizar una verificación básica de la misma. Tanto este paso como el siguiente se pueden realizar presencialmente en cualquiera de las <a href="http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" target="_blank" title="(se abre en ventana nueva)">26 Oficinas de Atención al Ciudadano</a> que hay por todo Madrid. Si preferimos hacerlo a través de la web, hacemos click en el enlace <a href="https://decide.madrid.es/account">"Mi cuenta"</a> de la parte superior derecha, y luego en el botón "Verificar mi cuenta". Lo primero que se nos pedirá es que introduzcamos nuestros datos de residencia, para verificar que estamos empadronados en el municipio de Madrid (es importante introducir el número de documento con la letra; y marcar la casilla de aceptación de acceso al Padrón). Si los datos son correctos, se nos pedirá un teléfono móvil para mandarnos un código de confirmación, que introduciremos en la siguiente página que se nos presente. Este móvil no se utilizará para contactarnos ni para enviarnos nada en ningún momento, sólo es una medida de seguridad. Si preferimos no dar ningún teléfono móvil, podemos realizar el proceso sin necesidad de él en las Oficinas de Atención al Ciudadano, como comentamos anteriormente. Una vez introducido correctamente el código de confirmación, nuestra cuenta nos permitirá apoyar propuestas.</li>
|
||||
<li>Para poder acceder a las votaciones finales de las propuestas, tendremos que verificar completamente nuestra cuenta. No obstante recuerda que la votación de propuestas es un proceso muy concreto que sólo ocurre durante una semana una vez las propuestas han llegado al 2% de apoyos, por lo tanto por lo general será posible realizar todas las acciones en la web con la anterior verificación básica de nuestracuenta. Para verificar completamente nuestra cuenta, podemos hacerlo presencialmente en cualquiera de las <a href="http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" target="_blank" title="(se abre en ventana nueva)">26 Oficinas de Atención al Ciudadano</a>, o bien a través de la web <a href="https://decide.madrid.es/users/sign_in">entrando</a> con nuestro correo y contraseña, hacer clic en el enlace <a href="https://decide.madrid.es/account">"Mi cuenta"</a> de la parte superior derecha, pulsar el botón "Finalizar verificación", y finalmente hacer click en "Solicitar el envío de un correo postal". Una vez solicitado, nos llegará a nuestra dirección de empadronamiento una carta, con un código de seguridad y unas sencillas instrucciones para realizar la verificación.</li>
|
||||
</ul>
|
||||
|
||||
@@ -84,10 +84,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.simple_captcha input_html: { required: false } %>
|
||||
</div>
|
||||
|
||||
<div class="actions small-12 column">
|
||||
<%= f.submit(class: "button", value: t("proposals.#{action_name}.form.submit_button")) %>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<div class="captcha">
|
||||
<%= simple_captcha_options[:image] %>
|
||||
<%= simple_captcha_options[:refresh_button] %>
|
||||
|
||||
<p class="note"><%= simple_captcha_options[:label] %></p>
|
||||
|
||||
<%= simple_captcha_options[:field] %>
|
||||
</div>
|
||||
@@ -40,10 +40,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.simple_captcha input_html: { required: false } %>
|
||||
</div>
|
||||
|
||||
<div class="actions small-12 column">
|
||||
<%= f.submit(class: "button", value: t("spending_proposals.form.submit_buttons.#{action_name}")) %>
|
||||
</div>
|
||||
|
||||
@@ -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 %>
|
||||
<span class="checkbox">
|
||||
|
||||
@@ -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"] %>
|
||||
|
||||
@@ -105,7 +105,6 @@ ignore_unused:
|
||||
- 'activerecord.*'
|
||||
- 'activemodel.*'
|
||||
- 'unauthorized.*'
|
||||
- 'simple_captcha.*'
|
||||
- 'admin.officials.level_*'
|
||||
- 'admin.comments.index.filter*'
|
||||
- 'admin.debates.index.filter*'
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
5
db/migrate/20160421090733_destroy_captcha_table.rb
Normal file
5
db/migrate/20160421090733_destroy_captcha_table.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class DestroyCaptchaTable < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :simple_captcha_data
|
||||
end
|
||||
end
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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: '<p>This is <script>alert("an attack");</script></p>'
|
||||
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: '<p>This is a link www.example.org</p>'
|
||||
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: "<script>alert('hey')</script> <a href=\"javascript:alert('surprise!')\">click me<a/> 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: "<script>alert('hey')</script> <a href=\"javascript:alert('surprise!')\">click me<a/> 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, <script>alert("hey");</script>'
|
||||
@@ -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"]
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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: '<p>This is <script>alert("an attack");</script></p>'
|
||||
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: '<p>This is a link www.example.org</p>'
|
||||
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: "<script>alert('hey')</script> <a href=\"javascript:alert('surprise!')\">click me<a/> 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, <script>alert("hey");</script>'
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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.'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user