module MathCaptcha::ControllerHelpers
Public Instance Methods
math_captcha_valid?()
click to toggle source
# File lib/math_captcha/controller.rb, line 3 def math_captcha_valid? return true if Rails.env.test? if params["captcha-value"] session_challenge = session[:captcha] crypted_challenge = MathCaptcha::Utils.generate_key(params['captcha-value']) result = crypted_challenge === session_challenge return result else return false end end