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
1 file changed
+2
-2
@@ -18,8 +18,8 @@ module RuCaptcha
|
||||
end
|
||||
|
||||
def verify_rucaptcha?(resource = nil)
|
||||
params[:_rucaptcha] ||= ''
|
||||
right = params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
||||
right = params[:_rucaptcha].present? and session[:_rucaptcha].present? and
|
||||
params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
||||
if resource && resource.respond_to?(:errors)
|
||||
resource.errors.add(:base, t('rucaptcha.invalid')) unless right
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user