Index: main/plugin-cms/stylesheets/helper/common_3.3.xsl
===================================================================
--- main/plugin-cms/stylesheets/helper/common_3.3.xsl	(revision 26293)
+++ main/plugin-cms/stylesheets/helper/common_3.3.xsl	(working copy)
@@ -49,6 +49,9 @@
 		<xsl:param name="image-alt-catalogue"/>
 		<xsl:param name="image-style"/>
 		<xsl:param name="image-class"/>
+		<xsl:param name="image-width">200</xsl:param>
+		<xsl:param name="image-height">50</xsl:param>
+		
 		
 		<xsl:param name="allow-refresh" select="true()"/>
 		
@@ -63,7 +66,7 @@
 				<input type="text" name="{$value-name}" maxlength="6" id="{$value-id}" style="{$value-style}" class="{$value-class}"/>
                 
 				<div class="captcha">
-					<img style="{$image-style}" class="{$image-class}" src="{$uri-prefix}/_cms/captcha/{$id}/image.png?color={$color}" id="{$image-id}">
+					<img style="{$image-style}" class="{$image-class}" src="{$uri-prefix}/_cms/captcha/{$id}/image.png?with={$image-width}&amp;height={$image-height}&amp;color={$color}" id="{$image-id}">
 		                <xsl:attribute name="alt">
 		                    <xsl:if test="$image-alt-i18n and $image-alt-catalogue != ''">
 		                        <xsl:value-of select="$image-alt-catalogue"/>
@@ -92,7 +95,7 @@
 				var oldId = document.getElementById("<xsl:value-of select="$key-id"/>").value;
 				document.getElementById("<xsl:value-of select="$key-id"/>").value = newId;
 				document.getElementById("<xsl:value-of select="$value-id"/>").value = "";
-				document.getElementById("<xsl:value-of select="$image-id"/>").src = "<xsl:value-of select="$uri-prefix"/>/_cms/captcha/" + newId + "/image.png?cancelledKey=" + oldId + "&amp;color=<xsl:value-of select="$color"/>";
+				document.getElementById("<xsl:value-of select="$image-id"/>").src = "<xsl:value-of select="$uri-prefix"/>/_cms/captcha/" + newId + "/image.png?cancelledKey=" + oldId + "&amp;width=<xsl:value-of select="$image-width"/>" + "&amp;height=<xsl:value-of select="$image-height"/>" + "&amp;color=<xsl:value-of select="$color"/>";
 				
 				if (focusNow == true)
 				{
Index: main/plugin-cms/src/org/ametys/cms/captcha/CreateAction.java
===================================================================
--- main/plugin-cms/src/org/ametys/cms/captcha/CreateAction.java	(revision 26293)
+++ main/plugin-cms/src/org/ametys/cms/captcha/CreateAction.java	(working copy)
@@ -45,8 +45,10 @@
         boolean fisheye = parameters.getParameterAsBoolean("fisheye", false);
         boolean noise = parameters.getParameterAsBoolean("noise", false);
         int color = parameters.getParameterAsInteger("color", 0x000000);
+        int width = parameters.getParameterAsInteger("width", 200);
+        int height = parameters.getParameterAsInteger("height", 50);
         
-        BufferedImage bi = CaptchaHelper.generateImageCaptcha(source, new Integer(color), noise, fisheye);
+        BufferedImage bi = CaptchaHelper.generateImageCaptcha(source, new Integer(color), noise, fisheye, width, height);
         
         Request request = ObjectModelHelper.getRequest(objectModel);
         request.setAttribute(BufferedImageReader.REQUEST_ATTRIBUTE, bi);
Index: main/plugin-cms/src/org/ametys/cms/captcha/CaptchaHelper.java
===================================================================
--- main/plugin-cms/src/org/ametys/cms/captcha/CaptchaHelper.java	(revision 26293)
+++ main/plugin-cms/src/org/ametys/cms/captcha/CaptchaHelper.java	(working copy)
@@ -232,7 +232,22 @@
      */
     public static synchronized BufferedImage generateImageCaptcha (String key, Integer color, boolean addNoise, boolean fisheye)
     {
-        Captcha captcha = _generateImageCaptcha(color, addNoise, fisheye);
+        return generateImageCaptcha(key, color, addNoise, fisheye, 200, 50);
+    }
+    
+    /**
+     * Generate an image captcha to PNG format. The key has to be unique, if you cannot generate a key use the other form of the method.
+     * @param key the wanted key. Can not be null. You can use RandomStringUtils.randomAlphanumeric(10) to generates one
+     * @param color The color for font
+     * @param addNoise true to add noise to captcha image
+     * @param fisheye true to add fish eye background to captcha image
+     * @param width The image width
+     * @param heigh The image heigh 
+     * @return The corresponding image
+     */
+    public static synchronized BufferedImage generateImageCaptcha (String key, Integer color, boolean addNoise, boolean fisheye, int width, int height)
+    {
+        Captcha captcha = _generateImageCaptcha(color, addNoise, fisheye, width, height);
         ValidableCaptcha vc = new ValidableCaptcha(captcha);
         
         if (key.startsWith(STATIC_PREFIX_KEY))
@@ -257,7 +272,7 @@
         return vc.getCaptcha().getImage();
     }
     
-    private static Captcha _generateImageCaptcha(Integer color, boolean addNoise, boolean fisheye)
+    private static Captcha _generateImageCaptcha(Integer color, boolean addNoise, boolean fisheye, int width, int height)
     {
         List<Color> colors = new ArrayList<Color>();
         colors.add(new Color(color));
@@ -266,7 +281,7 @@
         fonts.add(new Font("Arial", Font.BOLD, 40));
         fonts.add(new Font("Courier", Font.BOLD, 40));
         
-        Builder builder = new Captcha.Builder(200, 50)
+        Builder builder = new Captcha.Builder(width, height)
             .addText(new DefaultTextProducer(6, "abcdefghijklmnopqrstuvwxyz".toCharArray()), new DefaultWordRenderer(colors, fonts))
             .gimp(new RippleGimpyRenderer())
             .addNoise(new CurvedLineNoiseProducer(new Color(color), 3));
Index: main/workspace-cms/src/org/ametys/cms/workspace/LoginConfigGenerator.java
===================================================================
--- main/workspace-cms/src/org/ametys/cms/workspace/LoginConfigGenerator.java	(revision 0)
+++ main/workspace-cms/src/org/ametys/cms/workspace/LoginConfigGenerator.java	(revision 0)
@@ -0,0 +1,53 @@
+package org.ametys.cms.workspace;
+
+import java.io.IOException;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.generation.AbstractGenerator;
+import org.apache.cocoon.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+import org.ametys.runtime.config.Config;
+import org.ametys.runtime.plugins.core.authentication.FormBasedCredentialsProvider;
+
+/**
+ * generation of the security xml of the connexion
+ *
+ */
+public class LoginConfigGenerator extends AbstractGenerator 
+{
+
+    public void generate() throws IOException, SAXException, ProcessingException
+    {
+        String level = Config.getInstance().getValueAsString("runtime.login.security.level");
+        
+        boolean autoComplete = false;
+        boolean rememberMe = false;
+        boolean captcha = false;
+        
+        switch (level) 
+        { 
+            case FormBasedCredentialsProvider.SECURITY_LEVEL_HIGH: 
+                autoComplete = false;
+                rememberMe = false;
+                captcha = true;
+                break; 
+            case FormBasedCredentialsProvider.SECURITY_LEVEL_LOW: 
+                autoComplete = true;
+                rememberMe = true;
+                captcha = false;
+                break;
+        }
+        
+        contentHandler.startDocument();
+        XMLUtils.startElement(contentHandler, "FormConfig");
+        
+        XMLUtils.createElement(contentHandler, "autoComplete", String.valueOf(autoComplete));
+        XMLUtils.createElement(contentHandler, "rememberMe", String.valueOf(rememberMe));
+        XMLUtils.createElement(contentHandler, "captcha", String.valueOf(captcha));
+        
+        XMLUtils.endElement(contentHandler, "FormConfig");
+        contentHandler.endDocument(); 
+    }
+
+}
Index: main/workspace-cms/i18n/messages_en.xml
===================================================================
--- main/workspace-cms/i18n/messages_en.xml	(revision 26293)
+++ main/workspace-cms/i18n/messages_en.xml	(working copy)
@@ -37,6 +37,7 @@
 	<message key="WORKSPACE_CMS_LOGIN_PASSWORD">Password</message>
 	<message key="WORKSPACE_CMS_LOGIN_REMEMBER_ME">Remember password</message>
 	<message key="WORKSPACE_CMS_LOGIN_FAILED">Username or login incorrect</message>
+	<message key="WORKSPACE_CMS_LOGIN_FAILED_CAPTCHA">Username or login or captcha incorrect</message>
 	<message key="WORKSPACE_CMS_LOGIN_CONNECT">Connection</message>
 	
 	<!-- +
Index: main/workspace-cms/i18n/messages_fr.xml
===================================================================
--- main/workspace-cms/i18n/messages_fr.xml	(revision 26293)
+++ main/workspace-cms/i18n/messages_fr.xml	(working copy)
@@ -37,6 +37,7 @@
 	<message key="WORKSPACE_CMS_LOGIN_PASSWORD">Mot de passe</message>
 	<message key="WORKSPACE_CMS_LOGIN_REMEMBER_ME">Se souvenir du mot de passe</message>
 	<message key="WORKSPACE_CMS_LOGIN_FAILED">Nom d'utilisateur ou mot de passe incorrect</message>
+	<message key="WORKSPACE_CMS_LOGIN_FAILED_CAPTCHA">Nom d'utilisateur ou mot de passe ou captcha incorrect</message>
 	<message key="WORKSPACE_CMS_LOGIN_CONNECT">Connexion</message>
 	
 	<!-- +
Index: main/workspace-cms/stylesheets/login.xsl
===================================================================
--- main/workspace-cms/stylesheets/login.xsl	(revision 26293)
+++ main/workspace-cms/stylesheets/login.xsl	(working copy)
@@ -17,7 +17,12 @@
 <xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:exslt="http://exslt.org/common" 
-    xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+    xmlns:math="java.lang.Math"
+    extension-element-prefixes="math">
+    
+    <xsl:import href="plugin:cms://stylesheets/helper/common_3.3.xsl"/>    
+    
     
     <xsl:param name="login-failed"/>
     
@@ -27,6 +32,9 @@
     
     <xsl:variable name="workspace-resources" select="concat($contextPath, $workspaceURI, '/resources')"/>
     
+    <xsl:variable name="uniqueId" select="substring-after(math:random(), '.')"/>
+        
+    
     <xsl:template match="/">
     	<html xmlns="http://www.w3.org/1999/xhtml">
 			<head>
@@ -48,10 +56,31 @@
 		      		.form-connection .input label {float: left; width: 120px;}
 		      		.form-connection .button {text-align: center}
 		      		.form-connection .error {color: #9f0000; font-style:italic;}
-		      		.form-connection .transp {z-index: -1; background-color: #FFF; filter:alpha(opacity=30); opacity: 0.3; position: absolute; width: 340px; margin-top: 1px; margin-left: 80px; height: 185px}
-		      		.form-connection form {color: #333; font-size: 0.9em; width: 300px; height: 145px; padding: 20px; margin-right: auto; margin-left: auto; border: 1px solid #666; }
+		      		.form-connection .transp {z-index: -1; background-color: #FFF; filter:alpha(opacity=30); opacity: 0.3; position: absolute; width: 340px; margin-top: 1px; margin-left: 80px; height: 250px}
+		      		.form-connection form {color: #333; font-size: 0.9em; width: 300px; height: 210px; padding: 20px; margin-right: auto; margin-left: auto; border: 1px solid #666; }
 		      		.form-connection form input.text {color: #333; font-size: 1em; width: 150px}
+		      		.form-connection form input.captcha {color: #333; font-size: 1em; width: 150px}
+		      		.form-connection form img.captcha-image {margin-top: 10px; margin-left: 110px}
 		      		.form-connection form input.button {color: #333; font-size: 1em; }
+		      		
+		      		.form-connection form button.captcha-refresh-btn {
+						background: transparent url('<xsl:value-of select="$contextPath"/>/plugins/cms/resources/img/refresh_24.png') no-repeat left top;
+						height: 26px;
+						width: 26px;
+						border: 0 none;
+						margin-left: 5px;
+						margin-top: 16px;
+						float: right;
+						cursor: pointer;
+					}
+					
+					.form-connection form button.captcha-refresh-btn span {
+						visibility: hidden;
+						position: absolute !important;
+						top: -10000px;
+						left: -10000px;
+					}
+
 		       	 </style> 
 		       	 
 		       	 <xsl:comment>[if IE 7]&gt;
@@ -71,16 +100,66 @@
     				<p><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_HINT" i18n:catalogue="workspace.cms"/></p>
         			<div class="transp"></div>
         			<form method="post" action="">
-        				<div class="input">
-	        				<label for="Username"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_USERNAME" i18n:catalogue="workspace.cms"/></label>
-		    				<input class="text" type="text" name="Username" id="Username"/>
-		    			</div>
-	    				<div class="input">
-		    				<label for="Password"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_PASSWORD" i18n:catalogue="workspace.cms"/></label>
-		    				<input class="text" type="password" name="Password" id="Password"/>
-		    			</div>
-		    			<xsl:if test="$login-failed = 'true'"><span class="error"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_FAILED" i18n:catalogue="workspace.cms"/></span><br/><br/></xsl:if>
-	    				<input type="checkbox" name="rememberMe" id="rememberMe" value="true"/><label for="rememberMe"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_REMEMBER_ME" i18n:catalogue="workspace.cms"/></label>
+        				<xsl:choose> 
+	        				<xsl:when test="FormConfig/autoComplete ='false'">
+		        				<div class="input">
+			        				<label for="Username"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_USERNAME" i18n:catalogue="workspace.cms"/></label>
+				    				<input class="text" type="text" name="Username" id="Username"  autocomplete="off"/>
+				    			</div>
+			    				<div class="input">
+				    				<label for="Password"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_PASSWORD" i18n:catalogue="workspace.cms"/></label>
+				    				<input class="text" type="password" name="Password" id="Password"  autocomplete="off"/>
+				    			</div>
+			    			</xsl:when>
+			    			<xsl:otherwise>
+				    			<div class="input">
+			        				<label for="Username"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_USERNAME" i18n:catalogue="workspace.cms"/></label>
+				    				<input class="text" type="text" name="Username" id="Username"/>
+				    			</div>
+			    				<div class="input">
+				    				<label for="Password"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_PASSWORD" i18n:catalogue="workspace.cms"/></label>
+				    				<input class="text" type="password" name="Password" id="Password"/>
+				    			</div>
+			    			</xsl:otherwise>
+		    			</xsl:choose>
+		    			<xsl:if test="FormConfig/captcha ='true'">
+		    				<div class="input">
+		    					<label for="Captcha">Captcha</label>
+			                    <xsl:if test="FormResult/msg = 'invalid'">
+			                        <xsl:attribute name="class">invalid</xsl:attribute>
+			                    </xsl:if>
+			
+			                    <xsl:call-template name="captcha">
+			                        <xsl:with-param name="key-name" select="'captcha-key'"/>
+			            
+			                        <xsl:with-param name="value-name" select="'captcha'"/>
+			                        <xsl:with-param name="value-id" select="concat('captcha-', $uniqueId)"/>
+			                        <xsl:with-param name="value-class">captcha</xsl:with-param>
+			            
+			                        <xsl:with-param name="image-alt"/>
+			                        <xsl:with-param name="image-alt-i18n" select="false()"/>
+			                        <xsl:with-param name="image-class">captcha-image</xsl:with-param>
+			                        
+			                        <xsl:with-param name="image-height">40</xsl:with-param>
+			                        <xsl:with-param name="image-width">150</xsl:with-param>
+			                        
+			                        <xsl:with-param name="contextPath"><xsl:value-of select="$contextPath"/></xsl:with-param>
+			                    </xsl:call-template>                
+			                </div>
+		               	</xsl:if>
+		    			<xsl:if test="$login-failed = 'true'">
+		    				<xsl:choose>
+		    					<xsl:when test="FormConfig/captcha ='true'">
+		    						<span class="error"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_FAILED_CAPTCHA" i18n:catalogue="workspace.cms"/></span><br/><br/>
+		    					</xsl:when>
+		    					<xsl:otherwise>
+		    						<span class="error"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_FAILED" i18n:catalogue="workspace.cms"/></span><br/><br/>
+		    					</xsl:otherwise>
+		    				</xsl:choose>
+		    			</xsl:if>
+	    				<xsl:if test="FormConfig/rememberMe ='true'">
+	    					<input type="checkbox" name="rememberMe" id="rememberMe" value="true"/><label for="rememberMe"><i18n:text i18n:key="WORKSPACE_CMS_LOGIN_REMEMBER_ME" i18n:catalogue="workspace.cms"/></label>
+	    				</xsl:if>
 	    				<br style="clear: left"/><br/>
 	    				
 	    				<div class="button">
Index: main/workspace-cms/sitemap.xmap
===================================================================
--- main/workspace-cms/sitemap.xmap	(revision 26293)
+++ main/workspace-cms/sitemap.xmap	(working copy)
@@ -22,6 +22,7 @@
 			<map:generator name="ribbon-state" src="org.ametys.cms.workspace.ContextualClientSideStateGenerator"/>
 			<map:generator name="metadataset" src="org.ametys.cms.content.MetadataSetDefGenerator"/>
 			<map:generator name="workflow-tasks" src="org.ametys.cms.workflow.WorkflowTasksGenerator" logger="org.ametys.cms.sitemap.generator.workspace"/>
+			<map:generator name="configLogin" src="org.ametys.cms.workspace.LoginConfigGenerator"/>		
 		</map:generators>
 		
 		<map:actions>
@@ -82,9 +83,9 @@
 			<map:match pattern="">
 				<map:redirect-to uri="index.html"/>
 			</map:match>
-					
+
 			<map:match pattern="login.html">
-                <map:generate type="action-result" label="content"/>
+                <map:generate type="configLogin"/>
                 <map:transform type="xslt" src="stylesheets/login.xsl">
 					<map:parameter name="contextPath" value="{request:contextPath}"/>
 					<map:parameter name="workspaceURI" value="{request-attr:workspaceURI}"/>
@@ -98,7 +99,7 @@
             </map:match>
             
             <map:match pattern="login_failed.html">
-                <map:generate type="action-result" label="content"/>
+                <map:generate type="configLogin"/>
                 <map:transform type="xslt" src="stylesheets/login.xsl">
 					<map:parameter name="contextPath" value="{request:contextPath}"/>
 					<map:parameter name="workspaceURI" value="{request-attr:workspaceURI}"/>
@@ -136,6 +137,8 @@
 					<map:parameter name="cancelledKey" value="{request-param:cancelledKey}"/>
 					<map:parameter name="color" value="{request-param:color}"/>
 					<map:parameter name="noise" value="{request-param:noise}"/>
+					<map:parameter name="width" value="{request-param:width}"/>
+					<map:parameter name="height" value="{request-param:height}"/>
 					<map:parameter name="fisheye" value="{request-param:fisheye}"/>
 					<map:read type="buffered-image">
 						<map:parameter name="key" value="{1}"/>
