function finishForm() {
$('.register-box .submit-notification').remove();
if (!$('#agree-data').is(':checked')) {
$('#formSubmit').show();
$('.register-box #formSubmit').before('
You need to agree to the use of your personal data to Tour Guides.
');
return false;
}
if (!$('#agree-terms').is(':checked')) {
$('#formSubmit').show();
$('.register-box #formSubmit').before('You must accept the Terms and Conditions.
');
return false;
}
if (checkForSubmit()) {
$('#formSubmit').hide();
$('#formSubmit').before('
');
$.post("/Register@NewUser", {
'register_type': 'user',
'register_email': $('#register_email').val(),
'register_pass': $('#register_pass').val(),
'register_name': $('#register_name').val(),
'register_gender': $('#register_gender').val(),
'register_birth': $('#register_birth').val(),
'register_country': $('#register_country').val(),
'register_captcha': $('#register_captcha').val()
}, function (result) {
$('#form-loading').remove();
if (result.charAt(0) == "1") {
e = $('#register_email').val();
id = result.split(";")[1];
$('.register-box form, .register-box .social-login').remove();
$('.register-box').append('Your account has been created.
A verification email has been sent to
'+e+'.
Please check your emails and click on the link we\'ve sent you so that you can log in to TeamTourist.
Resend verification email
');
}
else if (result == "-1") {
$('#formSubmit').show();
$('.register-box #formSubmit').before('The verification code was incorrect.
Please try again.
');
refreshCaptcha();
}
else if (result == "0") {
$('#formSubmit').show();
$('.register-box #formSubmit').before('There was an error creating your account.
Please try again.
');
}
});
}
else {
$('#formSubmit').before('Please make sure that all the fields have been entered correctly.
');
}
}
function ResendVerification(obj, id) {
$.post("/Verify@ResendVerification", { ID: id }, function () {
$(obj).attr('onclick', '');
$(obj).html('Verification email sent again.');
});
}
function checkForSubmit() {
$('#register-box input[name], #register-box select[name], #register_pass, .dob-day')
.trigger('keyup')
.trigger('change')
.blur();
isReady = ( $('i.complete.fa-circle-o').size() == 0 );
return isReady;
}