You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
2.4 KiB

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Login page-->
<template id="login" inherit_id="web.login" name="Login Inherit">
<div class="form-group field-password" position="after">
<script src='https://www.google.com/recaptcha/api.js'></script>
<div id ="captcha" class="imageContainer">
<div class="form-group">
<!-- specify your site in data-sitekey attribute-->
<div class="g-recaptcha" data-sitekey="6LfvQ7AqAAAAAI3FGHmFxvwIoZor4UuM9tnJNvWu"
data-callback="verifyRecaptchaCallback" data-expired-callback="expiredRecaptchaCallback"></div>
<input class="form-control d-none" data-recaptcha="true"/>
<div class="help-block with-errors" id="err" style='color: red'></div>
</div>
</div>
<script>
$("form").submit(function(event) {
var recaptcha = $("#g-recaptcha-response").val();
if (recaptcha === "") {
event.preventDefault();
document.getElementById('err').innerHTML="Please verify Captcha";
}
else{
return true;
}
});
</script>
</div>
</template>
<!-- signup page-->
<template id="signup" inherit_id="auth_signup.fields" name="Signup Inherit">
<div class="form-group field-confirm_password" position="after">
<script src='https://www.google.com/recaptcha/api.js'></script>
<div id ="captcha" class="imageContainer" >
<div class="g-recaptcha" data-sitekey="6LfvQ7AqAAAAAI3FGHmFxvwIoZor4UuM9tnJNvWu"
data-callback="verifyRecaptchaCallback" data-expired-callback="expiredRecaptchaCallback"></div>
<input class="form-control d-none" data-recaptcha="true" />
<div class="help-block with-errors" id="err" style='color: red' required = "required"></div>
</div>
<script>
$(".oe_signup_form").submit(function(event) {
var recaptcha = $("#g-recaptcha-response").val();
if (recaptcha === "") {
event.preventDefault();
document.getElementById('err').innerHTML="Please check Captcha";
var $btn = $form.find('.oe_login_buttons > button[type="submit"]');
$btn.attr('enabled', 'enabled');
}
else{
return true;
}
});
</script>
</div>
</template>
</odoo>