Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5371 Zobrazení

The js script looks like this:


var sweetcaptcha = new require('sweetcaptcha')(appId, appKey, appSecret); // your sweetCaptcha application credentials, see https://sweetcatpcha.com/accounts/signin
// Get your captcha
function getCaptcha(callback) {
sweetcaptcha.api('get_html', callback); // callback should be function(err, html) {...}
}
// Validate using sckey and scvalue, hidden inputs from previous HTML
function validateCaptcha(captchaKey, captchaValue, callback) {
// callback = function(err, isValid) {...}
sweetcaptcha.api('check', {sckey: captchaKey, scvalue: captchaValue}, function(err, response){
if (err) return callback(err);
if (response === 'true') {
// valid captcha
return callback(null, true);
}
// invalid captcha
callback(null, false);
});
}
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
kvě 25
9400
3
bře 24
4930
0
dub 23
442
1
lis 23
5083
2
pro 22
5561