Captcha::Model::InstanceMethods

Public Instance Methods

captcha=(c) click to toggle source
# File lib/captcha/model.rb, line 22
def captcha=(c)
  @captcha = c || ''
end
captcha_must_match_known_captcha() click to toggle source
# File lib/captcha/model.rb, line 30
def captcha_must_match_known_captcha
  return true if self.captcha.nil? || self.known_captcha.nil?
  if self.captcha.strip.downcase != Captcha::Cipher.decrypt(self.known_captcha)
    if self.captcha_options[:base]
      self.errors.add_to_base(
        case self.captcha_options[:base]
        when true
          "Enter the correct text in the image (6 characters)"
        else
          self.captcha_options[:base]
        end
      )
    else
      self.errors.add(:captcha, 
        case self.captcha_options[:field]
        when true, nil
          "text does not match the text in the image."
        else
          self.captcha_options[:field]
        end
      )
    end
  end
end
known_captcha=(c) click to toggle source
# File lib/captcha/model.rb, line 26
def known_captcha=(c)
  @known_captcha = c || ''
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.