Commit 6767abef88d2b78c05b8c0edb67ca28e72348f6f
1 parent
3a43cd5e
Exists in
master
fix call to hash_error method; fix private_key validation
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
lib/recaptcha_plugin.rb
| @@ -20,9 +20,11 @@ class RecaptchaPlugin < Noosfero::Plugin | @@ -20,9 +20,11 @@ class RecaptchaPlugin < Noosfero::Plugin | ||
| 20 | msg_icve = _('Internal captcha validation error') | 20 | msg_icve = _('Internal captcha validation error') |
| 21 | msg_erpa = 'Environment recaptcha_plugin_attributes' | 21 | msg_erpa = 'Environment recaptcha_plugin_attributes' |
| 22 | 22 | ||
| 23 | - return RecaptchaVerification.hash_error(msg_icve, status, nil, "#{msg_erpa} private_key not defined") if private_key.nil? | ||
| 24 | - return RecaptchaVerification.hash_error(msg_icve, status, nil, "#{msg_erpa} version not defined") unless version == 1 || version == 2 | ||
| 25 | rv = RecaptchaVerification.new | 23 | rv = RecaptchaVerification.new |
| 24 | + | ||
| 25 | + return rv.hash_error(msg_icve, status, nil, "#{msg_erpa} private_key not defined") unless private_key.present? | ||
| 26 | + return rv.hash_error(msg_icve, status, nil, "#{msg_erpa} version not defined") unless version == 1 || version == 2 | ||
| 27 | + | ||
| 26 | if version == 1 | 28 | if version == 1 |
| 27 | verify_uri = 'https://www.google.com/recaptcha/api/verify' | 29 | verify_uri = 'https://www.google.com/recaptcha/api/verify' |
| 28 | return rv.verify_recaptcha_v1(remote_ip, private_key, verify_uri, params[:recaptcha_challenge_field], params[:recaptcha_response_field]) | 30 | return rv.verify_recaptcha_v1(remote_ip, private_key, verify_uri, params[:recaptcha_challenge_field], params[:recaptcha_response_field]) |