ASM::captcha_age

Description

Returns the age of the CAPTCHA challenge in seconds, or -1 if not applicable.

Syntax

ASM::captcha_age

Examples

# EXAMPLE: Send CAPTCHA challenge and validate the response, but to avoid
# blocking requests to which CAPTCHA challenge cannot be sent (non-HTML pages),
# send the CAPTCHA challenge on HTML pages after 30 seconds of aging, which is
# before the expiration of the answer.
when ASM_REQUEST_DONE {
    if {[ASM::captcha_status] eq "correct"} {
        if {[ASM::captcha_age] >= 30} {
            ASM::captcha
        }
    } else {
        if {[ASM::captcha] ne "ok"} {
             log local0. "cannot send captcha_challenge: \"$res\""
        }
    }
}