Skip to content

Commit 68b3079

Browse files
LUT-32081 V8 : Add a parameter to allow deactivation of captcha even if catpcha plugin is activated
1 parent 0f331bf commit 68b3079

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/java/fr/paris/lutece/plugins/contact/web/ContactApp.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import fr.paris.lutece.portal.service.security.LuteceUser;
5151
import fr.paris.lutece.portal.service.security.SecurityService;
5252
import fr.paris.lutece.portal.service.template.AppTemplateService;
53+
import fr.paris.lutece.portal.service.util.AppPropertiesService;
5354
import fr.paris.lutece.portal.service.util.BeanUtils;
5455
import fr.paris.lutece.portal.util.mvc.commons.annotations.Action;
5556
import fr.paris.lutece.portal.util.mvc.commons.annotations.View;
@@ -140,6 +141,7 @@ public class ContactApp extends MVCApplication
140141
private static final String PROPERTY_LIST_NOT_EXISTS = "contact.message_contact.listNotExists";
141142
private static final String PROPERTY_NOT_AUTHORIZED = "contact.message_contact.notauthorized";
142143
private static final String PROPERTY_NO_LIST_VISIBLE = "contact.message_contact.noListVisible";
144+
private static final String PROPERTY_CAPTCHA_ENABLED = "contact.captcha.enabled";
143145
private static final String CAPTCHA_PLUGIN = "captcha";
144146
private static final String EMPTY_STRING = "";
145147
private static final String ACTION_SEND_MESSAGE = "actionSendMessage";
@@ -201,7 +203,7 @@ public XPage getForm( HttpServletRequest request ) throws SiteMessageException
201203

202204
model.put( MARK_PORTAL_URL, strPortalUrl );
203205

204-
boolean bIsCaptchaEnabled = PluginService.isPluginEnable( CAPTCHA_PLUGIN );
206+
boolean bIsCaptchaEnabled = PluginService.isPluginEnable( CAPTCHA_PLUGIN ) && Boolean.parseBoolean( AppPropertiesService.getProperty( PROPERTY_CAPTCHA_ENABLED, "true" ) );
205207
model.put( MARK_IS_ACTIVE_CAPTCHA, bIsCaptchaEnabled );
206208

207209
if ( bIsCaptchaEnabled )
@@ -426,7 +428,8 @@ public XPage doSendMessage( HttpServletRequest request ) throws SiteMessageExcep
426428
}
427429

428430
// test the captcha
429-
if ( PluginService.isPluginEnable( CAPTCHA_PLUGIN ) )
431+
boolean bIsCaptchaEnabled = PluginService.isPluginEnable( CAPTCHA_PLUGIN ) && Boolean.parseBoolean( AppPropertiesService.getProperty( PROPERTY_CAPTCHA_ENABLED, "true" ) );
432+
if ( bIsCaptchaEnabled )
430433
{
431434

432435
boolean isValid = _captchaService.isResolvable( ) ? _captchaService.get( ).validate( request ) : false;

0 commit comments

Comments
 (0)