where does the actual registration happen?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

where does the actual registration happen?

maxelcat
Dear All

I have inserted a captcha field into our registration page. It validates
correctly. However the user is still registered even if the code is
incorrectly entered.

I have tried to find the part within the code which actaully does the
registering once the fields are correctly filled in. I could then put this
in an if statement which depends on $reg and the captcha field. However I
can't find it.

Please, please, please can someone now just help me finish off.

I attach a short version of the code I have.


## declare the plugin
#set($captchaPlugin = $xwiki.jcaptcha)

##verify captcha

##call the verifyCaptcha

#if($captchaPlugin.verifyCaptcha("edit"))

<h2>captcha correct</h2>
#else
<h2>captcha wrong</h2>
#end

  #if(!$reg||$reg<0 )
    <p>Welcome ......</p>
  #end
  #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')")
    #else
      #error("$msg.get('core.register.registerFailed', [$reg])")
    #end
  #elseif($reg)
    #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)

        <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>

##username
          <dt>$msg.get("core.register.username")</dt>
          <dd><input name="xwikiname" type="text" size="20" onfocus="
prepareName(document.forms.register);" /></dd>

##password

##lots of form fields here


#if ($captchaPlugin)

    $captchaPlugin.displayCaptcha("edit","register_captcha")
  #end


 <span class="buttonwrapper"><input type="submit"
value="$msg.get("core.register.submit")"/></span></div>



    </form>
  #end
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: where does the actual registration happen?

AjdinBrandic
I found the only way around this is to disable the default registration
and create your own.
 
You can use #set($reg = $xwiki.createUser(false))
To insert a new user once it passes any validation you have checked for.

Also use this to send an email (alert to yourself, confirmation to new
users etc)
#set($dumpMe =
$xwiki.mailsender.sendTextMessage('[hidden email]',
'[hidden email]', '[hidden email]', '[hidden email]',
'New user registration at myxwiki.org', $messageText, null))

Another problem with the default registration is that you can pass all
params in the url (GET) and it will register until you disable the
registration all together.

Ajdin


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Edward Laptop
Sent: 07 July 2009 21:56
To: XWiki Users
Subject: [xwiki-users] where does the actual registration happen?

Dear All

I have inserted a captcha field into our registration page. It validates
correctly. However the user is still registered even if the code is
incorrectly entered.

I have tried to find the part within the code which actaully does the
registering once the fields are correctly filled in. I could then put
this in an if statement which depends on $reg and the captcha field.
However I can't find it.

Please, please, please can someone now just help me finish off.

I attach a short version of the code I have.


## declare the plugin
#set($captchaPlugin = $xwiki.jcaptcha)

##verify captcha

##call the verifyCaptcha

#if($captchaPlugin.verifyCaptcha("edit"))

<h2>captcha correct</h2>
#else
<h2>captcha wrong</h2>
#end

  #if(!$reg||$reg<0 )
    <p>Welcome ......</p>
  #end
  #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')")
    #else
      #error("$msg.get('core.register.registerFailed', [$reg])")
    #end
  #elseif($reg)
    #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)

        <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>

##username
          <dt>$msg.get("core.register.username")</dt>
          <dd><input name="xwikiname" type="text" size="20" onfocus="
prepareName(document.forms.register);" /></dd>

##password

##lots of form fields here


#if ($captchaPlugin)

    $captchaPlugin.displayCaptcha("edit","register_captcha")
  #end


 <span class="buttonwrapper"><input type="submit"
value="$msg.get("core.register.submit")"/></span></div>



    </form>
  #end
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
 
 
--------------------------------------------------------

NOTICE

This message and any files transmitted with it is intended for the addressee only and may contain information that is confidential or privileged. Unauthorised use is strictly prohibited. If you are not the addressee, you should not read, copy, disclose or otherwise use this message, except for the purpose of delivery to the addressee.

Any views or opinions expressed within this e-mail are those of the author and do not necessarily represent those of Coventry University.
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: where does the actual registration happen?

maxelcat
thanks for the reply!

Believe it or not..... its working!



www.ee-web.co.uk
[hidden email] <mailto:[hidden email].uk07760>
07760 392284


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf
Of Ajdin Brandic
Sent: 08 July 2009 12:33
To: XWiki Users
Subject: Re: [xwiki-users] where does the actual registration happen?


I found the only way around this is to disable the default registration
and create your own.

You can use #set($reg = $xwiki.createUser(false))
To insert a new user once it passes any validation you have checked for.

Also use this to send an email (alert to yourself, confirmation to new
users etc)
#set($dumpMe =
$xwiki.mailsender.sendTextMessage('[hidden email]',
'[hidden email]', '[hidden email]', '[hidden email]',
'New user registration at myxwiki.org', $messageText, null))

Another problem with the default registration is that you can pass all
params in the url (GET) and it will register until you disable the
registration all together.

Ajdin


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Edward Laptop
Sent: 07 July 2009 21:56
To: XWiki Users
Subject: [xwiki-users] where does the actual registration happen?

Dear All

I have inserted a captcha field into our registration page. It validates
correctly. However the user is still registered even if the code is
incorrectly entered.

I have tried to find the part within the code which actaully does the
registering once the fields are correctly filled in. I could then put
this in an if statement which depends on $reg and the captcha field.
However I can't find it.

Please, please, please can someone now just help me finish off.

I attach a short version of the code I have.


## declare the plugin
#set($captchaPlugin = $xwiki.jcaptcha)

##verify captcha

##call the verifyCaptcha

#if($captchaPlugin.verifyCaptcha("edit"))

<h2>captcha correct</h2>
#else
<h2>captcha wrong</h2>
#end

  #if(!$reg||$reg<0 )
    <p>Welcome ......</p>
  #end
  #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')")
    #else
      #error("$msg.get('core.register.registerFailed', [$reg])")
    #end
  #elseif($reg)
    #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)

        <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>

##username
          <dt>$msg.get("core.register.username")</dt>
          <dd><input name="xwikiname" type="text" size="20" onfocus="
prepareName(document.forms.register);" /></dd>

##password

##lots of form fields here


#if ($captchaPlugin)

    $captchaPlugin.displayCaptcha("edit","register_captcha")
  #end


 <span class="buttonwrapper"><input type="submit"
value="$msg.get("core.register.submit")"/></span></div>



    </form>
  #end
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users


--------------------------------------------------------

NOTICE

This message and any files transmitted with it is intended for the addressee
only and may contain information that is confidential or privileged.
Unauthorised use is strictly prohibited. If you are not the addressee, you
should not read, copy, disclose or otherwise use this message, except for
the purpose of delivery to the addressee.

Any views or opinions expressed within this e-mail are those of the author
and do not necessarily represent those of Coventry University.
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

want to alter error comments

maxelcat
In reply to this post by AjdinBrandic

Hello

I want to alter the text that comes back when people make mistakes filling
in the registration form such as:

$msg.get('core.register.userAlreadyExists')

where do I find these please

thanks


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: where does the actual registration happen?

AjdinBrandic
In reply to this post by maxelcat
Did you get the original registration script to work (if so, HOW?) or created a bespoke one?

Ajdin


-----Original Message-----
From: [hidden email] on behalf of Edward Laptop
Sent: Wed 08/07/2009 12:55
To: XWiki Users
Subject: Re: [xwiki-users] where does the actual registration happen?
 
thanks for the reply!

Believe it or not..... its working!



www.ee-web.co.uk
[hidden email] <mailto:[hidden email].uk07760>
07760 392284


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf
Of Ajdin Brandic
Sent: 08 July 2009 12:33
To: XWiki Users
Subject: Re: [xwiki-users] where does the actual registration happen?


I found the only way around this is to disable the default registration
and create your own.

You can use #set($reg = $xwiki.createUser(false))
To insert a new user once it passes any validation you have checked for.

Also use this to send an email (alert to yourself, confirmation to new
users etc)
#set($dumpMe =
$xwiki.mailsender.sendTextMessage('[hidden email]',
'[hidden email]', '[hidden email]', '[hidden email]',
'New user registration at myxwiki.org', $messageText, null))

Another problem with the default registration is that you can pass all
params in the url (GET) and it will register until you disable the
registration all together.

Ajdin


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Edward Laptop
Sent: 07 July 2009 21:56
To: XWiki Users
Subject: [xwiki-users] where does the actual registration happen?

Dear All

I have inserted a captcha field into our registration page. It validates
correctly. However the user is still registered even if the code is
incorrectly entered.

I have tried to find the part within the code which actaully does the
registering once the fields are correctly filled in. I could then put
this in an if statement which depends on $reg and the captcha field.
However I can't find it.

Please, please, please can someone now just help me finish off.

I attach a short version of the code I have.


## declare the plugin
#set($captchaPlugin = $xwiki.jcaptcha)

##verify captcha

##call the verifyCaptcha

#if($captchaPlugin.verifyCaptcha("edit"))

<h2>captcha correct</h2>
#else
<h2>captcha wrong</h2>
#end

  #if(!$reg||$reg<0 )
    <p>Welcome ......</p>
  #end
  #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')")
    #else
      #error("$msg.get('core.register.registerFailed', [$reg])")
    #end
  #elseif($reg)
    #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)

        <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>

##username
          <dt>$msg.get("core.register.username")</dt>
          <dd><input name="xwikiname" type="text" size="20" onfocus="
prepareName(document.forms.register);" /></dd>

##password

##lots of form fields here


#if ($captchaPlugin)

    $captchaPlugin.displayCaptcha("edit","register_captcha")
  #end


 <span class="buttonwrapper"><input type="submit"
value="$msg.get("core.register.submit")"/></span></div>



    </form>
  #end
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users


--------------------------------------------------------

NOTICE

This message and any files transmitted with it is intended for the addressee
only and may contain information that is confidential or privileged.
Unauthorised use is strictly prohibited. If you are not the addressee, you
should not read, copy, disclose or otherwise use this message, except for
the purpose of delivery to the addressee.

Any views or opinions expressed within this e-mail are those of the author
and do not necessarily represent those of Coventry University.
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: where does the actual registration happen?

maxelcat
As it happens I did use the orriginal registration script, and in theory its
not difficult. Took quite a long time for me work it out though.

Happy to send script if it helps

Edward

 


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users