From 6767abef88d2b78c05b8c0edb67ca28e72348f6f Mon Sep 17 00:00:00 2001 From: Marcelo JĂșnior Date: Mon, 25 Jan 2016 19:05:09 -0300 Subject: [PATCH] fix call to hash_error method; fix private_key validation --- lib/recaptcha_plugin.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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