Hello.
Recpatcha is still working like a charm.
Here are some examples about how to use it.
if you want to have Recaptcha in login form, set it like this:
in models.py
#import recaptcha
from gluon.tools import Recaptcha2
#enable recaptcha in login form.
auth.settings.captcha = Recaptcha2(request, public_key='key1', private_key='key2', label='')
If you want to use it in SQLFORM.
define some functions for convenience in models.py or in other place
ex:
#function to be used in a form without database
def captcha_field(request=request):
w = lambda x, y: Recaptcha2(request,
'public_key',
'private_key',
)
return Field('captcha', 'string', label='', widget=w, default='ok')
#function to be used in a sqlform
def captcha_sqlform():
recaptcha2 = Recaptcha2(request, 'public_key', 'private_key', '')
return DIV(LABEL("", _class="form-control-label col-sm-3"),DIV(recaptcha2, _class="col-sm-9"), _class="form-group row",_name="recaptcha_form")
#append the recaptcha to sqlform
form = SQLFORM(db.table, keep_values=True)
form[0].insert(-1, captcha_sqlform())
This will add the recpatcha validation to the form.
Greetings.
Chris.