Merge pull request #3 from anvyzhang/rt_master
Verify fail if captcha was blank in session or params.
This commit is contained in:
commit
437410bd43
|
@ -18,8 +18,8 @@ module RuCaptcha
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_rucaptcha?(resource = nil)
|
def verify_rucaptcha?(resource = nil)
|
||||||
params[:_rucaptcha] ||= ''
|
right = params[:_rucaptcha].present? and session[:_rucaptcha].present? and
|
||||||
right = params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
||||||
if resource && resource.respond_to?(:errors)
|
if resource && resource.respond_to?(:errors)
|
||||||
resource.errors.add(:base, t('rucaptcha.invalid')) unless right
|
resource.errors.add(:base, t('rucaptcha.invalid')) unless right
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue