Hi,

The double action="" attribute is a mistake. The missing attribute value means that the form is submitted to the same URL. The registration should work, unless you don't have the right to register new users. The login action returns some cookies, which must be kept and passed with the registration request.

Sergiu

On 4/19/07, Thomas Krämer <tk@ontopica.de> wrote:
Hi Dumitriu,

I tried the REST approach, as you depicted
> This approach seems to be OK. But you can also use a REST approach,
> meaning that you learn how does the registration form work, then create
> a fake request (GET or POST, which one is easier). If registration is
> not public, then you also need to send some authentication tokens
> (cookies).
>

I use the common httpclient to imitate a users behavior.
I can succesfully login as a user, doing a PostMethod with
"/xwiki/bin/loginsubmit/XWiki/XWikiLogin"
This is not what a users sees in his browsers adress bar, but what
appears in the form in the html source.

But, calling the registration page
http://localhost:8080/xwiki/bin/register/XWiki/Register ,
setting the parameters to a new request (on the same httpclient object)

        PostMethod registerMethod = new PostMethod(registerUrl);
        loginPost.addParameter("template", "XWiki.XWikiUserTemplate");
        loginPost.addParameter("register", "1");
        loginPost.addParameter("register_first_name", "");
        loginPost.addParameter("register_last_name", "");
        loginPost.addParameter("register2_password", "875656");
        loginPost.addParameter("register_password", "875656");
        loginPost.addParameter("register_email", "gzt6@web.de");
        loginPost.addParameter ("xwikiname", "horatio");
        loginPost.addParameter("submit", "register");
        loginPost.addParameter("Register", "1");

does not work.

Why is that so?

Examining the source, i was wondering, why there is no action in the
html form:


<form id="register" name="register" action="" action="" method="post">


What is the reason for that?
What is the URL i have to set to a PostMethod?
And: Why does the action attribute appear twice in the form?



Yours

Thomas


Btw: Congrats to RC1, you've all been probably quite busy theese days.
Great work!

Thanks.

--
http://purl.org/net/sergiu