lib/simple_captcha/controller.rb in simple_captcha2-0.3.0 vs lib/simple_captcha/controller.rb in simple_captcha2-0.3.1
- old
+ new
@@ -13,17 +13,19 @@
# 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?
if params[:captcha]
data = SimpleCaptcha::Utils::simple_captcha_value(params[:captcha_key] || session[:captcha])
result = data == params[:captcha].delete(" ").upcase
SimpleCaptcha::Utils::simple_captcha_passed!(session[:captcha]) if result
- return result
+ @_simple_captcha_result = result
+ result
else
- return false
+ false
end
end
end
end