Commit e6dcbafefb776a5e950e0499df46997478626223

Authored by Evandro Junior
2 parents 22ae060c 6767abef
Exists in master

Merge branch 'master' of softwarepublico.gov.br:noosfero-plugins/recaptcha

* 'master' of softwarepublico.gov.br:noosfero-plugins/recaptcha:
  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 20 msg_icve = _('Internal captcha validation error')
21 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 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 28 if version == 1
27 29 verify_uri = 'https://www.google.com/recaptcha/api/verify'
28 30 return rv.verify_recaptcha_v1(remote_ip, private_key, verify_uri, params[:recaptcha_challenge_field], params[:recaptcha_response_field])
... ...