diff --git a/lib/recaptcha_plugin.rb b/lib/recaptcha_plugin.rb index 4951ea1..9ee8ef8 100644 --- a/lib/recaptcha_plugin.rb +++ b/lib/recaptcha_plugin.rb @@ -20,9 +20,11 @@ class RecaptchaPlugin < Noosfero::Plugin msg_icve = _('Internal captcha validation error') msg_erpa = 'Environment recaptcha_plugin_attributes' - return RecaptchaVerification.hash_error(msg_icve, status, nil, "#{msg_erpa} private_key not defined") if private_key.nil? - return RecaptchaVerification.hash_error(msg_icve, status, nil, "#{msg_erpa} version not defined") unless version == 1 || version == 2 rv = RecaptchaVerification.new + + return rv.hash_error(msg_icve, status, nil, "#{msg_erpa} private_key not defined") unless private_key.present? + return rv.hash_error(msg_icve, status, nil, "#{msg_erpa} version not defined") unless version == 1 || version == 2 + if version == 1 verify_uri = 'https://www.google.com/recaptcha/api/verify' return rv.verify_recaptcha_v1(remote_ip, private_key, verify_uri, params[:recaptcha_challenge_field], params[:recaptcha_response_field]) -- libgit2 0.21.2