Module: Kamcaptcha::Validation

Defined in:
lib/kamcaptcha/validation.rb

Instance Method Summary collapse

Instance Method Details

#kamcaptcha_validates?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
# File 'lib/kamcaptcha/validation.rb', line 3

def kamcaptcha_validates?
  return false unless defined?(params)
  return false unless params.respond_to?(:key?)
  return false unless params.key?(:kamcaptcha)

  token = instance_exec(&Kamcaptcha::Token.lookup)

  Kamcaptcha::Token.valid?(token, params[:kamcaptcha][:input])
end