You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Götz <to...@richmountain.de> on 2010/05/03 22:13:58 UTC
Math captcha with Wicket?
Did anyone ever integrate some kind of math capture with Wicket ("please
solve the following simple equation ...")? How would I do this, someone
got a code pointer for me?
-Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by nino martinez wael <ni...@gmail.com>.
I know it was a dry spirited answer.. But have a look at jcaptcha or
simplecaptcha.. Both are built around servlets as far as I can see,
but they might offer a question / image engine also (so you can use it
directly with wicket)..
regards Nino
2010/5/6 Thomas Götz <to...@richmountain.de>:
> nino martinez wael schrieb:
>>
>> http://java.sun.com/docs/books/tutorial/2d/overview/rendering.html
>
> Well, tanks ;-)
> I was hoping to find some ready-to-be-used library/components that already
> does that ...
>
> -Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by Thomas Götz <to...@richmountain.de>.
Thanks for the pointer!
-Tom
Josh Glassman schrieb:
> Take a look at
>
> http://wicket.apache.org/docs/1.4/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.html
>
> You might need to override some of it, or make your own customized version
> to get the text and look you want. Looks like a good starting point at
> least.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by Josh Glassman <jo...@gmail.com>.
Take a look at
http://wicket.apache.org/docs/1.4/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.html
You might need to override some of it, or make your own customized version
to get the text and look you want. Looks like a good starting point at
least.
On Thu, May 6, 2010 at 10:08 AM, Thomas Götz <to...@richmountain.de> wrote:
> nino martinez wael schrieb:
>
> http://java.sun.com/docs/books/tutorial/2d/overview/rendering.html
>>
>
> Well, tanks ;-)
> I was hoping to find some ready-to-be-used library/components that already
> does that ...
>
> -Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Math captcha with Wicket?
Posted by Thomas Götz <to...@richmountain.de>.
nino martinez wael schrieb:
> http://java.sun.com/docs/books/tutorial/2d/overview/rendering.html
Well, tanks ;-)
I was hoping to find some ready-to-be-used library/components that
already does that ...
-Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by nino martinez wael <ni...@gmail.com>.
http://java.sun.com/docs/books/tutorial/2d/overview/rendering.html
:)
2010/5/4 Thomas Götz <to...@richmountain.de>:
> Thanks for your input, Igor! Looks nice, but I'd also like to have that as a
> rendered image, rather than plain text (security risk?).
>
> -Tom
>
> Igor Vaynberg wrote:
>>
>> off the top of my head
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by Thomas Götz <to...@richmountain.de>.
Thanks for your input, Igor! Looks nice, but I'd also like to have that
as a rendered image, rather than plain text (security risk?).
-Tom
Igor Vaynberg wrote:
> off the top of my head
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Math captcha with Wicket?
Posted by Igor Vaynberg <ig...@gmail.com>.
off the top of my head
class question { int lhs, int rhs, boolean plus;
void randomize() { lhs=math.random()*10, rhs=math.random()*10;
plus=math.random()>0.5;}
string tostring() { return ""+lhs+" "+((plus)?"+":"-")+" "+rhs; }
boolean check(int answer) { if (plus) return answer==lhs+rhs else
return answer==lhs-rhs; }
class answerfield extends textfield<integer> {
private final imodel<question> question;
public answerfield(string id, imodel<question> question) {
super(id, new model<integer>());
this.question=question;
add(new ivalidator<integer> {
public void validate(validatable<integer> validatable) {
if (!question.check(validatable.getvalue()) {
validatable.error(new validationerror("are you
smarter then a first grader?"));
});
}
protected void ondetach() { question.detach(); super.ondetach(); }
}
class mathcaptchapanel extends panel {
private final question question=new question();
public mathcaptchapanel(string id) {
add(new label("question", new propertymodel(this, "question"));
add(new answerfield("answer", new propertymodel(this, "question"));
}
protected void onbeforerender() { question.randomize();
super.onbeforerender(); }
}
-igor
On Mon, May 3, 2010 at 1:13 PM, Thomas Götz <to...@richmountain.de> wrote:
> Did anyone ever integrate some kind of math capture with Wicket ("please
> solve the following simple equation ...")? How would I do this, someone got
> a code pointer for me?
>
> -Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org