i have use jQuery Real Person at keith-wood.name/realPerson.html
. However, after config and test, It's not work.As follow is snippet code in view.Look so it's ok, show capcha
$('.realperson_text').realperson({ length: 6, chars: $.realperson.alphanumeric });
<div class="form-group input-group-sm"> <h5>Capcha</h5> <div class="realperson_text"></div> @Html.TextBoxFor(p => p.defaultReal, new { @class = "form-control text-uppercase", @placeholder = "type capcha code", @maxlength = "6" }) </div>
public ActionResult UploadProfile(TestModel capcha_demo) { var salt = 12345; if (rpHash(capcha_demo.defaultReal + salt) != Request.Form["realPersonHash"]) { ViewBag.Message = "Capcha wrong"; } }
Yep, as demo in home page, I don't known what is the Request.Form["realPersonHash"]
. Can you tell me how to get it ?
The trick this plugin use it's to add an element before form submit.
In plugin code jquery.realperson.js line 112 you have this code:
on('submit.' + inst.name, function() {
var name = inst.options.hashName.replace(/\{n\}/, elem.attr('name'));
var form = $(this);
form.find('input[name="' + name + '"]').remove();
form.append('<input type="hidden" class="' + self._hashClass + '" name="' + name +
'" value="' + hash(text + salt) + '">');
setTimeout(function() {
form.find('input[name="' + name + '"]').remove();
}, 0);
});
You can see that it add an input (form.append), and delete it just after the submit
form.find('input[name="' + name + '"]').remove();
That's all the trick!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.