>
> def checkuser():
a = request.vars.username
> b = db((db.auth_user.username==str(a))).select().first()
> if b is not None:
> b.update_record(Attempts=b.Attempts + 1)
>
Note, you don't need to bother first checking for the record, so you can
save a query by just doing the update:
auth.settings.login_onfail = lambda: db(db.auth_user.username == request.
vars.username).update(
Attempts=db.auth_user.Attempts + 1)
> auth.settings.login_onvalidation = [lambda form: loginonval(form)]
>
Note, if you've already got a function that takes the correct set of
arguments, you don't need to wrap it in a lambd -- just do:
auth.settings.login_onvalidation = [loginonval]
Also, rather than a complete lockout, you might consider locking out for a
limited time (e.g., 15 or 30 minutes).
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.