TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shami Sheikh
NA
124
11.3k
How To Increase Recaptcha Security
Aug 2 2018 5:38 AM
Hi
I am using google recaptcha v2 in my application I'd integrate it in client side.
Here is my code.
<script>
var
onloadCallback =
function
() {
grecaptcha.render(
'recaptcha'
, {
'sitekey'
:
'6Lc_qmcUAAAAAJW_kALWjJEwhHGiNWszGXdiBOo5'
,
'callback'
: reCaptchaCallback,
});
};
var
reCaptchaCallback =
function
(response) {
if
(response !==
''
) {
console.log(response);
}
};
function
getReCaptchaRes() {
var
message =
'Please check the checkbox'
;
if
(
typeof
(grecaptcha) !=
'undefined'
) {
var
response = grecaptcha.getResponse();
(response.length === 0) ? (message =
'Captcha verification failed'
) : (message =
''
);
}
$(
'#reCaptchaLblMsg'
).html(message).css(
'color'
,
"red"
);
return
!(response.length === 0)
}
submitHandler:
function
(form) {
// call the google recaptcha validation
if
(getReCaptchaRes()) {
$(
'.spinner-holder'
).css(
'display'
,
'block'
);
$(
"#myAjaxRegisterModal2 input[type='submit']"
).val(
"Saving ..."
).attr(
'disabled'
,
'disabled'
);
var
__RequestVerificationToken = $(
'[name="__RequestVerificationToken"]'
).val();
var
RegisterData = {
__RequestVerificationToken: __RequestVerificationToken,
ProfileCreatedFor: $(
'#ddlProfileCreatedFor'
).val(),
GroomBrideName: $(
'#txtName'
).val(),
Mobile: $(
'#txtMobile'
).val(),
EmailID: $(
'#txtEmail'
).val(),
Height: $(
'#ddlHeight'
).val(),
Gender: $(
"input[name='Gender']:checked"
).val(),
MaritalStatus: $(
'#ddlMaritalStatus'
).val(),
DOBMonth: $(
'#ddlMonth'
).val(),
DOBDate: $(
'#ddlDate'
).val(),
DOBYear: $(
'#ddlYear'
).val(),
State: $(
'#ddlUserState'
).val(),
City: $(
'#ddlCity'
).val(),
Section: $(
'#ddlUserSection'
).val(),
DivisonText: $(
'#DivisonText'
).val(),
Password: $(
'#ConfirmPassword'
).val()
}
//form.submit();
$.ajax({
url:
"/Home/RegisterNewMemberByJson"
,
type:
"POST"
,
data: RegisterData,
dataType:
'json'
,
success:
function
(data) {
if
(data ==
"Error"
) {
window.location.href =
"/Home/Index"
;
}
else
if
(data ==
true
) {
$(
'#myAjaxRegisterModal2'
).modal(
'hide'
);
RegisterPopUp();
}
else
{
$(
'.spinner-holder'
).hide();
$(
"#myAjaxRegisterModal2 input[type='submit']"
).val(
"Save"
).removeAttr(
"disabled"
);
$(
'#ageErrorMsg'
).text(data);
}
}
});
}
}
</script>
But my concern is if I will change response from browser console then I can hit the ajax method multiple times using a loop. So how can I prevent it to hit my ajax method into loop Or there is something wrong with my captcha integration.
My another concern is is it possible to check the captcha response on the client side as well as on the server side. if possible then how
Reply
Answers (
2
)
Sphinx search using c#
How i can remove Thos error