Module: Google::Recaptcha

Defined in:
lib/TheresNoBox/google.rb

Class Method Summary collapse

Class Method Details

.verify(params, ip) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/TheresNoBox/google.rb', line 95

def self.verify(params, ip)
  data = {:privatekey=> Settings.recaptchaPriveKey,
    :remoteip=> ip,
    :challenge=> params[:recaptcha_challenge_field], 
    :response=> params[:recaptcha_response_field]
  }
  text = RestClient.post 'http://www.google.com/recaptcha/api/verify', data 
  text = text.split("\n\r")

  if text[0] == 'true'
    return true
  else
    return false
  end
end