Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Reload captcha image issues
luasoft
New
i'm making a captcha plugin for integration into New Discussion, Edit Discussion, Post Comment forms.
i'm having problem loading captcha image when post data failed (captcha session value is always changing after every form is clicked)
default vanilla forums using ajax to save disucssion, comment.
Currently, i have two temporary solutions:
Solution 1: Add script and always reload captcha image after every form is clicked, like this:
<script> jQuery(document).ready(function($) { $('.DiscussionButton').on('click',function() { setTimeout(function() { ReloadCaptchaImage(); }, 500); }); }); </script>
Solution 2: Modify javascript code of vanilla forums (\applications\vanilla\js\post.js)
// Hijack discussion form button clicks $('#DiscussionForm :submit').live('click', function() { [...] $.ajax({ [...] success: function(json) { if (json.FormSaved == false) { ReloadCaptchaImage(); // my function $(frm).prepend(json.ErrorMessages); json.ErrorMessages = null; } [...] }, [...] });
i don't want to always load captcha image (Solution 1),
and I don't want to modify javascript code of vanilla (Solution 2)
Are there any other solutions better?
Thanks.
Tagged:
0
Comments
definitions['LastCommentID']
changes after a successful save. Maybe that helps you. You could get the original value on load and compare after each click if it has changed and decide based on that fact, if you load a new captcha.