Commit 52c8beaa10a246bc36ad60a568811644412f87ff
Exists in
staging
and in
1 other branch
Merge branch 'rename_test_captcha_to_verify_captcha' into staging
Showing
7 changed files
with
15 additions
and
15 deletions
Show diff stats
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
plugins/recaptcha
plugins/serpro_captcha
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