Index: /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/web/RegisterAction.java
===================================================================
--- /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/web/RegisterAction.java	(revision 1054)
+++ /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/web/RegisterAction.java	(working copy)
@@ -1,24 +1,24 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author sdumitriu
+ */
 package com.xpn.xwiki.web;
 
 import org.apache.velocity.VelocityContext;
@@ -28,17 +28,31 @@
 import com.xpn.xwiki.XWikiException;
 import com.xpn.xwiki.doc.XWikiDocument;
 
+import java.io.IOException;
+
+
 public class RegisterAction extends XWikiAction {
-	public boolean action(XWikiContext context) throws XWikiException {
+    public boolean action(XWikiContext context) throws XWikiException {
         XWiki xwiki = context.getWiki();
         XWikiRequest request = context.getRequest();
         XWikiResponse response = context.getResponse();
         XWikiDocument doc = context.getDoc();
+        int result = -1;
+        String register = request.getParameter("register");
+        String xwikiname = request.getParameter("xwikiname");
 
-        String register = request.getParameter("register");
+        if(register != null){
+            if(xwikiname ==null || xwikiname.equals("") || !xwikiname.matches("\\w+")){
+                XWikiException exp = new XWikiException(XWikiException.MODULE_XWIKI_APP,
+                        XWikiException.ERROR_XWIKI_APP_PROPERTY_NAME_NOT_CORRECT,"XwikiName not correct");
+                context.put("exp",exp);
+                context.put("message","<h2>Xwiki Name not correct</h2>");
+                return true ;
+            }
+        }
+
         if ((register!=null)&&(register.equals("1"))) {
             int useemail = xwiki.getXWikiPreferenceAsInt("use_email_verification", 0, context);
-            int result;
             if (useemail==1)
              result = xwiki.createUser(true, "edit", context);
             else
@@ -47,16 +61,24 @@
             vcontext.put("reg", new Integer(result));
         }
 
-        String redirect = Utils.getRedirect(request, null);
+        String redirect = Utils.getRedirect(request, request.getParameter("template"));
         if (redirect==null)
             return true;
-        else {
+        else if(result == 1){
+            String url = doc.getURL("view",context);
+            int index = url.indexOf("/XWiki/") ;
+            url=url.substring(0,index+"/XWiki/".length())+xwikiname ;
+            context.put("message","Registration of <strong>"+xwikiname+"</strong> " +
+                    "<br/>The user <a href='"+url+"'>"+xwikiname+"</a> has been correctly registered.");
+            return true ;
+        }else
+        {
             sendRedirect(response, redirect);
             return false;
         }
-	}
-	
-	public String render(XWikiContext context) throws XWikiException {
+    }
+
+    public String render(XWikiContext context) throws XWikiException {
         return "register";
-	}
+    }
 }
