[xwiki-dev] registration of new users in xwiki from external application : appropriate rights not set

Thomas Krämer tk at ontopica.de
Thu Apr 19 22:42:03 CEST 2007


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




More information about the devs mailing list