Hi,
Not exactly, I think you are thinking of:
> $captchaservice.isAnswerCorrect($sessionId, $answer)
>
Yes. I believe here sessionId is generated by the captcha service for each
captcha displayed? Or is it something else?
I'm asking because recaptcha generates a unque captchaId for each captcha it
generates. Then you need to handover this captchaId + user's answer to the
server to verify the answer.
> while captchaName is the hint for getting a component from the component
> manager. eg:
> $captchaservice.isAnswerCorrect("defaultImageCaptcha", $answer)
>
Ok, I understand now.
> The fact that the last call to the struts based jcaptcha component was from
> same session
> means that the answer provided will work.
>
> Perhaps it would be best to offer a way to check the answer with the
> sessionId
> either A:
> $captchaservice.isAnswerCorrect("defaultImageCaptcha", $sessionId, $answer)
>
> or B:
> #set($captcha = $captchaservice.getCaptcha("defaultImageCaptcha"))
> $captcha.isAnswerCorrect($sessionId, $answer)
>
Both sounds good. Although I like the second form.
> Also an easy way to get the session id using $request in Velocity?
> Something like:
>
> A:
> #set($sessionId = $captchaservice.getSessionId($request))
>
> or B:
> #set($sessionId = $captcha.getSessionId($request))
>
I don't know whether binding velocity APIs to HTTPRequest is a good idea,
but it will surely make things easy. We could even have something like:
#set($captcha = $captchaservice.getCaptcha("defaultImageCaptcha"))
$captcha.isAnswerCorrect($request)
So we leave all the parameter resolution to the captcha component itself.
Thanks.
- Asiri
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs