Commit 52c8beaa10a246bc36ad60a568811644412f87ff

Authored by Victor Costa
2 parents 6f9c7a0d 19459230

Merge branch 'rename_test_captcha_to_verify_captcha' into staging

lib/noosfero/api/helpers.rb
... ... @@ -435,8 +435,8 @@ require_relative '../../find_by_contents'
435 435 # captcha_helpers #
436 436 ##########################################
437 437  
438   - def test_captcha(remote_ip, params, environment)
439   - captcha_plugin_enabled = @plugins.dispatch(:test_captcha, remote_ip, params, environment).map {|p| p if ! ( p===nil ) }
  438 + def verify_captcha(remote_ip, params, environment)
  439 + captcha_plugin_enabled = @plugins.dispatch(:verify_captcha, remote_ip, params, environment).map {|p| p if ! ( p===nil ) }
440 440 return true if captcha_plugin_enabled.size == 0
441 441 if captcha_plugin_enabled.size > 1
442 442 return render_api_error!(_("Error processing Captcha"), 500, nil, "More than one captcha plugin enabled")
... ...
lib/noosfero/api/session.rb
... ... @@ -12,9 +12,9 @@ module Noosfero
12 12 ################################
13 13 post "/login-captcha" do
14 14 remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
15   - # test_captcha will render_api_error! and exit in case of any problem
  15 + # verify_captcha will render_api_error! and exit in case of any problem
16 16 # this return is just to improve the clarity of the execution path
17   - return unless test_captcha(remote_ip, params, environment)
  17 + return unless verify_captcha(remote_ip, params, environment)
18 18 ## Creates and caches a captcha session store
19 19 store = Noosfero::API::SessionStore.create("captcha")
20 20 ## Initialize the data for the session store
... ... @@ -70,9 +70,9 @@ module Noosfero
70 70 post "/register" do
71 71 attrs = attributes_for_keys [:email, :login, :password, :password_confirmation] + environment.signup_person_fields
72 72 remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
73   - # test_captcha will render_api_error! and exit in case of any problem
  73 + # verify_captcha will render_api_error! and exit in case of any problem
74 74 # this return is just to improve the clarity of the execution path
75   - return unless test_captcha(remote_ip, params, environment)
  75 + return unless verify_captcha(remote_ip, params, environment)
76 76  
77 77 name = params[:name].present? ? params[:name] : attrs[:email]
78 78 attrs[:password_confirmation] = attrs[:password] if !attrs.has_key?(:password_confirmation)
... ... @@ -134,9 +134,9 @@ module Noosfero
134 134 requestors = fetch_requestors(params[:value])
135 135 not_found! if requestors.blank?
136 136 remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
137   - # test_captcha will render_api_error! and exit in case of any problem
  137 + # verify_captcha will render_api_error! and exit in case of any problem
138 138 # this return is just to improve the clarity of the execution path
139   - return unless test_captcha(remote_ip, params, environment)
  139 + return unless verify_captcha(remote_ip, params, environment)
140 140 requestors.each do |requestor|
141 141 ChangePassword.create!(:requestor => requestor)
142 142 end
... ... @@ -152,9 +152,9 @@ module Noosfero
152 152 requestors = fetch_requestors(params[:value])
153 153 not_found! if requestors.blank?
154 154 remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
155   - # test_captcha will render_api_error! and exit in case of any problem
  155 + # verify_captcha will render_api_error! and exit in case of any problem
156 156 # this return is just to improve the clarity of the execution path
157   - return unless test_captcha(remote_ip, params, environment)
  157 + return unless verify_captcha(remote_ip, params, environment)
158 158 requestors.each do |requestor|
159 159 requestor.user.resend_activation_code
160 160 end
... ...
lib/noosfero/plugin.rb
... ... @@ -679,7 +679,7 @@ class Noosfero::Plugin
679 679 end
680 680  
681 681 #By default will return nil that will mean not implented by the plugin
682   - def test_captcha(*args)
  682 + def verify_captcha(*args)
683 683 nil
684 684 end
685 685  
... ...
plugins/recaptcha
1   -Subproject commit 6767abef88d2b78c05b8c0edb67ca28e72348f6f
  1 +Subproject commit e6dcbafefb776a5e950e0499df46997478626223
... ...
plugins/serpro_captcha
1   -Subproject commit c6a155b608056d1cba387904e4ca34a5145a073f
  1 +Subproject commit 195958f5b26e1e117edff66122b0a388563baa99
... ...
test/unit/api/helpers_test.rb
... ... @@ -254,7 +254,7 @@ class APIHelpersTest < ActiveSupport::TestCase
254 254  
255 255 should 'do not test captcha when there is no captcha plugin enabled' do
256 256 environment = Environment.new
257   - assert test_captcha("127.0.0.1", {}, environment)
  257 + assert verify_captcha("127.0.0.1", {}, environment)
258 258 end
259 259  
260 260 ###### END Captcha tests ######
... ...
test/unit/api/test_helper.rb
... ... @@ -11,7 +11,7 @@ end
11 11 module Noosfero
12 12 module API
13 13 module APIHelpers
14   - def test_captcha(*args)
  14 + def verify_captcha(*args)
15 15 return true if OutcomeCaptcha.outcome_captcha_test
16 16 render_api_error!("Error testing captcha", 403)
17 17 end
... ...