AlterEgo
old web2py blog
Useful Links
List all entries
Book
Interactive Examples
F.A.Q.
Free Applications
Plugins
Recipes
Demo of Admin Interface
Semantic web extension
Some of the information here may be outdated, please check the book instead
Edit page
Title:
Security Code:
Body:
(use
this
wiki markup)
If you need to use captcha we strongly suggest outsourcing to recaptcha.net It could not be easier. here is how to: - register at recaptcha.net (they give you a private_key and a public_key) - download [this file](http://mdp.cti.depaul.edu/AlterEgo/default/download/document.file.565223690281.py) and save it as models/recaptcha.py - use the RECAPTCHA helper (defined in file above) as in the following... Example: public_key='xxx' ### provided by recaptcha.net private_key='xxx' ### provided by recaptcha.net def index(): form=FORM(RECAPTCHA(request,public_key,private_key),INPUT(_type='submit')) if form.accepts(request.vars,session): response.flash='done!' elif form.errors.has_key('captcha'): response.flash='invalid capctha' else: response.flash='some other error in your form' return dict(form=form) The RECAPTCHA helper works very much as the input helper but it always take (request,public_key,private_key) and validates itself. If it does no pass validation an error message is stored in form.errors['captcha'] but not displayed. It is up to the developer to display the error as appropriate.
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by
web2py
- design derived from a theme by
the earlybird
The content of this book is released under the
Artistic License 2.0
- Modified content cannot be reproduced.