Index: main/plugin-ugc/pages/services/ugc/form_1.0.xsl
===================================================================
--- main/plugin-ugc/pages/services/ugc/form_1.0.xsl	(revision 29736)
+++ main/plugin-ugc/pages/services/ugc/form_1.0.xsl	(working copy)
@@ -83,7 +83,19 @@
 						'content-type': $j('#ugc-<xsl:value-of select="$uniqueId"/>-ctype').val()
 					}
 					var url = '<xsl:value-of select="$uri-prefix"/>/plugins/ugc/create-content';
-					$j.post(url, params, ugc_createcontent_cb_<xsl:value-of select="$uniqueId"/>)
+					
+					function handleError()
+                    {
+                        alert("<i18n:text i18n:key="PLUGINS_UGC_CONTENT_SENT_ERROR_AJAX" i18n:catalogue="plugin.ugc"/>");
+                    }
+                    
+                    $j.ajax({
+                        url: url,
+                        data: params,
+                        type: 'post',
+                        success: ugc_createcontent_cb_<xsl:value-of select="$uniqueId"/>,
+                        error: handleError
+                    });   
 				}
 			}
 			
@@ -122,7 +134,11 @@
 				$j('#ugc-<xsl:value-of select="$uniqueId"/>-preview-content').html('');
 				
 				// Refresh captcha
-				refresh_ugc_<xsl:value-of select="$uniqueId"/>();
+				var hasCaptcha = '<xsl:value-of select="/page-info/has-captcha" />'; 
+				if (hasCaptcha == "true")
+				{
+				    refresh_ugc_<xsl:value-of select="$uniqueId"/>();
+				}
 				
 				return false;
 			}
@@ -132,12 +148,20 @@
 				var form = $j('#form-<xsl:value-of select="$uniqueId"/>');
 					
 				var idInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-id');
+				var pageIdInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-pageId');
+                
 				var nameInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-name');
 				var emailInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-email');
 				var emailHideInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-hide-email');
-				var captchaKey = $j('#ugc-<xsl:value-of select="$uniqueId"/>-captcha-key');
-				var captchaInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-captcha');
-					
+				
+				var hasCaptcha = '<xsl:value-of select="/page-info/has-captcha" />'; 
+				var captchaKey;
+				var captchaInput;
+				if (hasCaptcha == "true")
+			    {
+			        captchaKey = $j('#ugc-<xsl:value-of select="$uniqueId"/>-captcha-key');
+				    captchaInput = $j('#ugc-<xsl:value-of select="$uniqueId"/>-captcha');
+				}	
 				var errors = false;
 					
 				if (/^\s*$/.test(nameInput.val()))
@@ -150,7 +174,7 @@
 					nameInput.parentsUntil('.field').parent().removeClass('error');
 				}
 					
-				if (/^\s*$/.test(emailInput.val()) || !/^([a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3})?$/.test(emailInput.val()))
+				if (/^\s*$/.test(emailInput.val()) || !/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,})?$/.test(emailInput.val()))
 				{
 					errors = true;
 					emailInput.parentsUntil('.field').parent().addClass('error');
@@ -169,17 +193,20 @@
 				{
 					idInput.parentsUntil('.field').parent().removeClass('error');
 				}
-					
-				if (!/^[a-z]{6}$/.test(captchaInput.val()))
-				{
-					errors = true;
-					captchaInput.parentsUntil('.field').parent().addClass('error');
-				}
-				else
+				
+				if (hasCaptcha == "true")	
 				{
-					captchaInput.parentsUntil('.field').parent().removeClass('error');
-				}
-
+					if (!/^[a-z]{6}$/.test(captchaInput.val()))
+					{
+						errors = true;
+						captchaInput.parentsUntil('.field').parent().addClass('error');
+					}
+					else
+					{
+						captchaInput.parentsUntil('.field').parent().removeClass('error');
+					}
+                }
+                
 				if (!errors)
 				{
 					// send it in ajax
@@ -187,11 +214,16 @@
 						"content-id": idInput.val(),
 						"name": nameInput.val(),
 						"email": emailInput.val(),
-						"captcha-key": captchaKey.val(),
-						"captcha-value": captchaInput.val(),
+					    "page-id": pageIdInput.val(),
 						"ajax": "true"
 					};
 					
+					if (hasCaptcha == "true")
+					{
+					   data["captcha-key"] = captchaKey.val();
+                       data["captcha-value"] = captchaInput.val();
+					}
+					
 					if (emailHideInput[0].checked)
 					{
 						data["hide-email"] = "on"; 
@@ -256,7 +288,8 @@
 						<input type="hidden" name="siteName" id="ugc-{$uniqueId}-site" value="{ametys:site()}"/>
 						<input type="hidden" name="workflow-name" id="ugc-{$uniqueId}-workflowname" value="ugc"/>
 						<input type="hidden" name="action-id" id="ugc-{$uniqueId}-actionId" value="1"/>
-						
+						<input type="hidden" name="page-id" id="ugc-{$uniqueId}-pageId" value="{ametys:pageId()}"/>
+                        
 						<xsl:call-template name="ugc-form-showhint"/>			
 						<xsl:call-template name="ugc-form-field-name"/>
 						<xsl:call-template name="ugc-form-field-mail"/>
@@ -264,7 +297,11 @@
 						<xsl:call-template name="ugc-form-field-title"/>
 	        			<xsl:call-template name="ugc-form-field-content"/>
 	        			<xsl:call-template name="ugc-form-field-preview"/>
-						<xsl:call-template name="ugc-form-field-captcha"/>
+	        			
+	        			<xsl:if test="/page-info/has-captcha = 'true'">
+        	        		<xsl:call-template name="ugc-form-field-captcha"/>
+	        			</xsl:if>
+						
 						<xsl:call-template name="ugc-form-field-reset"/>
 						<xsl:call-template name="ugc-form-field-submit"/>
 						<div class="buttons-end"></div>
@@ -299,7 +336,12 @@
 				</label>
 			</div>
 			<div class="input">
-				<input type="text" name="name" id="ugc-{$uniqueId}-name"/>
+			     <xsl:variable name="id" select="concat('ugc-', $uniqueId, '-name')"/>
+				<input type="text" name="name" id="{$id}"/>
+				<xsl:call-template name="fill-user-input">
+                    <xsl:with-param name="id" select="$id"/>
+                    <xsl:with-param name="field" select="'fullname'"/>
+                </xsl:call-template>
 			</div>
 			<div class="field-end"></div>
 		</div>
@@ -314,7 +356,12 @@
 				</label>
 			</div>
 			<div class="input">
-				<input type="text" name="email" id="ugc-{$uniqueId}-email"/>
+			    <xsl:variable name="id" select="concat('ugc-', $uniqueId, '-email')"/>
+				<input type="text" name="email" id="{$id}"/>
+                <xsl:call-template name="fill-user-input">
+                    <xsl:with-param name="id" select="$id"/>
+                    <xsl:with-param name="field" select="'email'"/>
+                </xsl:call-template>
 			</div>
 			<div class="field-end"></div>
 		</div>
Index: main/plugin-ugc/sitemap.xmap
===================================================================
--- main/plugin-ugc/sitemap.xmap	(revision 29736)
+++ main/plugin-ugc/sitemap.xmap	(working copy)
@@ -21,6 +21,7 @@
         	<map:generator name="available-content-types" src="org.ametys.plugins.ugc.generators.AvailableContentTypesForUGCGenerator" logger="org.ametys.ugc.generators"/>
         	<map:generator name="search-ugc-contents" src="org.ametys.plugins.ugc.generators.SearchValidatedUGCContents" logger="org.ametys.ugc.generators"/>
         	<map:generator name="preview" src="org.ametys.plugins.ugc.generators.PreviewGenerator" logger="org.ametys.ugc.generators"/>
+            <map:generator name="info-user" src="org.ametys.plugins.ugc.generators.PageInfoGenerator" logger="org.ametys.ugc.generators"/>
         </map:generators>
         
         <map:actions>
@@ -58,7 +59,9 @@
         	</map:match>
         	
         	<map:match pattern="ugc/form.html">
-				<map:generate type="action-result"/>
+				<map:generate type="info-user">
+				</map:generate>
+<!--                 <map:generate type="action-result"></map:generate> -->
 				<map:transform src="service://@xslt"/>
 				<map:transform type="i18n">
 					<map:parameter name="locale" value="{request-attr:sitemapLanguage}"/>
Index: main/plugin-ugc/src/org/ametys/plugins/ugc/actions/ProposeUGCContentAction.java
===================================================================
--- main/plugin-ugc/src/org/ametys/plugins/ugc/actions/ProposeUGCContentAction.java	(revision 29736)
+++ main/plugin-ugc/src/org/ametys/plugins/ugc/actions/ProposeUGCContentAction.java	(working copy)
@@ -49,7 +49,10 @@
 import org.ametys.plugins.workflow.Workflow;
 import org.ametys.runtime.captcha.CaptchaHelper;
 import org.ametys.runtime.user.UsersManager;
+import org.ametys.web.pageaccess.PageAccessManager;
+import org.ametys.web.repository.page.Page;
 import org.ametys.web.repository.site.SiteManager;
+import org.ametys.web.site.SiteConfigurationExtensionPoint;
 
 import com.opensymphony.workflow.WorkflowException;
 
@@ -59,10 +62,11 @@
 public class ProposeUGCContentAction extends ServiceableAction implements ThreadSafe
 {
     /** The pattern to check emails */
-    public static final Pattern EMAIL_VALIDATOR = Pattern.compile("^([a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-zA-Z0-9]{2,})?$");
-    
+    public static final Pattern EMAIL_VALIDATOR = Pattern.compile("^([a-zA-Z0-9]+(([\\.\\-\\_]?[a-zA-Z0-9]+)+)?)\\@(([a-zA-Z0-9]+[\\.\\-\\_])+[a-zA-Z0-9]{2,})$");
     /** The request parameter name for content id */
     public static final String PARAMETER_CONTENTID = "content-id";
+    /** The request parameter name for page id */
+    public static final String PARAMETER_PAGE_ID = "page-id";
     /** The request parameter name for content id */
     public static final String PARAMETER_CTYPE = "content-type";
     /** The request parameter name for content language */
@@ -92,6 +96,10 @@
     protected Workflow _workflow;
     /** The site manager */
     protected SiteManager _siteManager;
+    /** The page acces manager */
+    protected PageAccessManager _accessManager;
+    /** The site configuration */
+    protected SiteConfigurationExtensionPoint _siteConfiguration;
     
     @Override
     public void service(ServiceManager smanager) throws ServiceException
@@ -102,6 +110,8 @@
         _usersManager = (UsersManager) manager.lookup(UsersManager.ROLE);
         _workflow = (Workflow) smanager.lookup(Workflow.ROLE);
         _siteManager = (SiteManager) smanager.lookup(SiteManager.ROLE);
+        _accessManager = (PageAccessManager) smanager.lookup(PageAccessManager.ROLE);
+        _siteConfiguration = (SiteConfigurationExtensionPoint) smanager.lookup(SiteConfigurationExtensionPoint.ROLE);
     }
     
     @Override
@@ -276,20 +286,45 @@
             errors.add("plugin.ugc:PLUGINS_UGC_CONTENT_ERROR_EMAIL");
         }
 
-        String captchaKey = request.getParameter(PARAMETER_CAPTCHA_KEY);
-        String captchaValue = request.getParameter(PARAMETER_CAPTCHA_VALUE);
-        if (StringUtils.isBlank(captchaKey) || StringUtils.isBlank(captchaValue))
+        if (_hasCaptcha(request))
         {
-            errors.add("plugin.ugc:PLUGINS_UGC_CONTENT_ERROR_CAPTCHA");
-        }
-        else 
-        {
-            if (!CaptchaHelper.checkAndInvalidate(captchaKey, captchaValue))
+            String captchaKey = request.getParameter(PARAMETER_CAPTCHA_KEY);
+            String captchaValue = request.getParameter(PARAMETER_CAPTCHA_VALUE);
+            if (StringUtils.isBlank(captchaKey) || StringUtils.isBlank(captchaValue))
             {
                 errors.add("plugin.ugc:PLUGINS_UGC_CONTENT_ERROR_CAPTCHA");
             }
+            else 
+            {
+                if (!CaptchaHelper.checkAndInvalidate(captchaKey, captchaValue))
+                {
+                    errors.add("plugin.ugc:PLUGINS_UGC_CONTENT_ERROR_CAPTCHA");
+                }
+            }
         }
 
         return errors;
     }
+    
+    private boolean _hasCaptcha(Request request)
+    {
+        String pageId = request.getParameter(PARAMETER_PAGE_ID);
+        Page page = _resolver.resolveById(pageId);
+        
+        String siteName = page.getSiteName();
+        
+        String displayCaptcha = _siteConfiguration.getValueAsString(siteName, "display-captcha");
+        boolean hasCaptcha;
+        
+        if (displayCaptcha.equals("restricted")) 
+        {
+            hasCaptcha = !_accessManager.getAccessInfo(page).isRestricted(); 
+        }
+        else 
+        {
+            hasCaptcha = displayCaptcha.equals("always");
+        }
+        
+        return hasCaptcha;
+    }
 }
Index: main/plugin-ugc/src/org/ametys/plugins/ugc/generators/PageInfoGenerator.java
===================================================================
--- main/plugin-ugc/src/org/ametys/plugins/ugc/generators/PageInfoGenerator.java	(revision 0)
+++ main/plugin-ugc/src/org/ametys/plugins/ugc/generators/PageInfoGenerator.java	(revision 0)
@@ -0,0 +1,64 @@
+package org.ametys.plugins.ugc.generators;
+
+import java.io.IOException;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.generation.ServiceableGenerator;
+import org.apache.cocoon.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+import org.ametys.web.pageaccess.PageAccessManager;
+import org.ametys.web.repository.page.Page;
+import org.ametys.web.site.SiteConfigurationExtensionPoint;
+
+public class PageInfoGenerator extends ServiceableGenerator
+{
+    /** The page access manager */
+    protected PageAccessManager _accessManager;
+    /** The site configuration */
+    protected SiteConfigurationExtensionPoint _siteConfiguration;
+    
+    @Override
+    public void service(ServiceManager smanager) throws ServiceException
+    {
+        super.service(smanager);
+        _accessManager = (PageAccessManager) smanager.lookup(PageAccessManager.ROLE);
+        _siteConfiguration = (SiteConfigurationExtensionPoint) smanager.lookup(SiteConfigurationExtensionPoint.ROLE);
+    }
+    
+    public void generate() throws IOException, SAXException, ProcessingException
+    {
+        Request request = ObjectModelHelper.getRequest(objectModel);
+                
+        contentHandler.startDocument();
+        XMLUtils.startElement(contentHandler, "page-info");
+        XMLUtils.createElement(contentHandler, "has-captcha", _hasCaptcha(request) ? "true" : "false");
+        XMLUtils.endElement(contentHandler, "page-info");
+        contentHandler.endDocument();
+    }
+    
+    private boolean _hasCaptcha(Request request)
+    {
+        Page page = (Page) request.getAttribute(Page.class.getName());
+        String siteName = (String) request.getAttribute("site");
+        
+        String displayCaptcha = _siteConfiguration.getValueAsString(siteName, "display-captcha");
+        boolean hasCaptcha;
+        
+        if (displayCaptcha.equals("restricted")) 
+        {
+            hasCaptcha = !_accessManager.getAccessInfo(page).isRestricted(); 
+        }
+        else 
+        {
+            hasCaptcha = displayCaptcha.equals("always");
+        }
+        
+        return hasCaptcha;
+    }
+
+}
