You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README mentions that HONEYPOT_VALUE and HONEYPOT_VERIFIER can be used to "implement a more advanced technique such as using timestamps".
It would be nice to include a recipe so people don't have to reinvent the wheel. I use something like this:
utils/honeypot.py:
importtimefromdjango.core.signingimportBadSignature, SignerSALT='honey'defvalue_generator():
# Return monotonic timestamp (won't ever go backwards)signer=Signer(salt=SALT)
value=int(time.monotonic())
returnsigner.sign(value)
defvalue_verifier(value):
# Verify that the submitted value was generated at most# an hour (in seconds) agosigner=Signer(salt=SALT)
try:
value=signer.unsign(value)
exceptBadSignature:
returnFalseelse:
return0<time.monotonic() -int(value) <60*60
The README mentions that
HONEYPOT_VALUE
andHONEYPOT_VERIFIER
can be used to "implement a more advanced technique such as using timestamps".It would be nice to include a recipe so people don't have to reinvent the wheel. I use something like this:
utils/honeypot.py
:settings.py
:The text was updated successfully, but these errors were encountered: