[xwiki-users] Captcha validates but still Registers

Campbell, Timothy D tcampbell106 at wssu.edu
Mon Mar 24 19:52:37 CET 2008


thanks for your reply,
 
I seen the thread posted and it worked successfully when it came to validating the captcha. The problem came where it validated and it correctly said it was wrong but still registered. It must be a logical condition error that I have done and will look into. Thanks for your reply and help. One question though, do you have any knowlege on what "$reg" is/does or where exactly does it register. This would be very beneficial in writing the correct condition. 
 
Tim Campbell
Junior, Computer Science-Ecommerce major
Winston Salem State University
tcampbell106 at wssu.edu
(704) 877-2261

________________________________

From: users-bounces at xwiki.org on behalf of Sachin Mittal
Sent: Fri 3/21/2008 2:34 AM
To: users at xwiki.org
Subject: Re: [xwiki-users] Captcha validates but still Registers




yes this is the way its working currently.

Currently the captcha is not handled during user registration.
So either you would have to custom build it for your work or wait till it
gets added by xwiki team.

There was some thread on this where I had suggested what can be done to add
the validate captcha hook. Search the forum for "captcha" to find other
threads on the same.

Thanks
Sachin


Campbell, Timothy D wrote:
>
> Hello all, I previously had an error with inputing JCaptcha on the
> register page. I figured out how to enable this plugin and I successful
> have it on the register page and it validates the captcha. (Meaning if it
> is wrong it throws an error code and if it is correct it registers user).
> The problem I am facing now is that even though it throughs an error code,
> it still registers the user. Do anyone have any insight on why it might be
> doing this? I am pasting my code below to better help the solution of this
> problem.
>
> Tim Campbell
> Junior, Computer Science-Ecommerce major
> Winston Salem State University
> tcampbell106 at wssu.edu
> (704) 877-2261
> 
> <h1>$msg.get("core.register.title")</h1>
>
> ## declare the plugin
>
> #set($captchaPlugin = $xwiki.jcaptcha)
>
> #if ($captchaPlugin && $reg)
>
> ##call the verifyCaptcha
>
> #if($captchaPlugin.verifyCaptcha("edit"))
>
> ##register the user
>
> #$xwiki.createUser(false)
>
> #else
>
> ##display some error
>
> #error("$msg.get('core.register.registerFailed', [$reg])")
>
> #end
>
> #end
>
> #if(!$xwiki.hasAccessLevel("view","XWiki.Registration")||$xwiki.getDocument("XWiki.Registration").isNew())
>
> #if(!$reg||$reg<0)
>
> <p>$msg.get("core.register.welcome")</p>
>
> #if($reg && $reg<=0)
>
> #if($reg==-2)
>
> #error("$msg.get('core.register.passwordMismatch')")
>
> #elseif($reg==-3)
>
> #error("$msg.get('core.register.userAlreadyExists')")
>
> #elseif($reg==-4)
>
> #error("$msg.get('core.register.invalidUsername')")
>
> #elseif($reg==-8)
>
> #error("$msg.get('core.register.userAlreadyExists')")
>
> #elseif($captchaPlugin != "edit")
>
> #error("$msg.get('core.register.registerFailed', [$reg])")
>
> #else
>
> #error("$msg.get('core.register.registerFailed', [$reg])")
>
> #end
>
> #end
>
> #elseif($reg && $captchaPlugin.verifyCaptcha("edit"))
>
> #set($xwname = "XWiki.${request.xwikiname}")
>
> #info("$msg.get('core.register.successful', [$xwiki.getUserName($xwname),
> $request.xwikiname])")
>
> #end
>
> #if(!$reg||$reg<0)
>
> <form id="register" action="verifyCaptcha" method="post">
>
> <div>
>
> #set($captchaPlugin = $xwiki.jcaptcha)
>
> #if ($captchaPlugin)
>
> ##call the displayCaptcha pass the class name as "register_captcha" which
> should map to the css classname to render the image
>
> ##pass the name as edit
>
> ##and under
> http:// <http:///> <host>:<port>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object&
>
> ##under XWiki.XWikiPreferences[0]: XWiki.DefaultSkin select the values for
> Anonymous: and Registered: as image or text
>
> <input type="hidden" name="template" value="XWiki.XWikiUserTemplate" />
>
> <input type="hidden" name="register" value="1"/>
>
> #set($class = $xwiki.getClass("XWiki.XWikiUsers"))
>
> #set($obj = $class.newObject())
>
> #set($serverobj = $class.newObject())
>
> #set($discard = $doc.use("XWiki.XWikiUsers"))
>
> #if($request.register_first_name)
>
> $doc.set("first_name", $request.register_first_name)
>
> #end
>
> #if($request.register_last_name)
>
> $doc.set("last_name", $request.register_last_name)
>
> #end
>
> <dl>
>
> #set($prop = $class.first_name)
>
> <dt>$msg.get("core.register.firstName")</dt>
>
> <dd>$doc.displayEdit($prop, "register_", $obj)</dd>
>
> #set($prop = $class.last_name)
>
> <dt>$msg.get("core.register.lastName")</dt>
>
> <dd>$doc.displayEdit($prop, "register_", $obj)</dd>
>
> <dt>$msg.get("core.register.username")</dt>
>
> <dd><input name="xwikiname" type="text" size="20" onfocus="
> prepareName(document.forms.register);" /></dd>
>
> #set($prop = $class.password)
>
> <dt>$msg.get("core.register.password")</dt>
>
> <dd>$doc.displayEdit($prop, "register_", $obj)</dd>
>
> <dt>$msg.get("core.register.passwordRepeat")</dt>
>
> <dd>$doc.displayEdit($prop, "register2_", $obj)</dd>
>
> #set($prop = $class.email)
>
> <dt>$msg.get("core.register.email")</dt>
>
> <dd>$doc.displayEdit($prop, "register_", $obj)</dd>
>
> $captchaPlugin.displayCaptcha("edit","register_captcha")
>
> #end
>
> </dl>
>
> <input type="submit" value="$msg.get("core.register.submit")"/>
>
> </div>
>
> </form>
>
> #end
>
> #else
>
> $xwiki.getDocument("XWiki.Registration").getTranslatedDocument().getRenderedContent()
>
> #end
>
> ##end
>
> 
>
> 
>
> 
>
> 
>
>
> _______________________________________________
> users mailing list
> users at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
>


-----
http://www.assembla.com/wiki/show/sachin_mittal about me:
--
View this message in context: http://www.nabble.com/Captcha-validates-but-still-Registers-tp16187345p16194473.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

_______________________________________________
users mailing list
users at xwiki.org
http://lists.xwiki.org/mailman/listinfo/users




More information about the users mailing list