lib/simple_captcha/controller.rb in simple_captcha2-0.4.0 vs lib/simple_captcha/controller.rb in simple_captcha2-0.4.2
- old
+ new
@@ -13,10 +13,10 @@
# flash[:notice] = "captcha did not match"
# redirect_to :action => "myaction"
# end
def simple_captcha_valid?
return true if SimpleCaptcha.always_pass
- return @_simple_captcha_result unless @_simple_captcha_result.nil?
+ return @_simple_captcha_result unless !defined?(@_simple_captcha_result) || @_simple_captcha_result.nil?
if params[:captcha]
captcha_key = params[:captcha_key] || session[:captcha]
data = SimpleCaptcha::Utils::simple_captcha_value(captcha_key)
result = data == params[:captcha].delete(" ").upcase