|
50 | 50 | import fr.paris.lutece.portal.service.security.LuteceUser; |
51 | 51 | import fr.paris.lutece.portal.service.security.SecurityService; |
52 | 52 | import fr.paris.lutece.portal.service.template.AppTemplateService; |
| 53 | +import fr.paris.lutece.portal.service.util.AppPropertiesService; |
53 | 54 | import fr.paris.lutece.portal.service.util.BeanUtils; |
54 | 55 | import fr.paris.lutece.portal.util.mvc.commons.annotations.Action; |
55 | 56 | import fr.paris.lutece.portal.util.mvc.commons.annotations.View; |
@@ -140,6 +141,7 @@ public class ContactApp extends MVCApplication |
140 | 141 | private static final String PROPERTY_LIST_NOT_EXISTS = "contact.message_contact.listNotExists"; |
141 | 142 | private static final String PROPERTY_NOT_AUTHORIZED = "contact.message_contact.notauthorized"; |
142 | 143 | private static final String PROPERTY_NO_LIST_VISIBLE = "contact.message_contact.noListVisible"; |
| 144 | + private static final String PROPERTY_CAPTCHA_ENABLED = "contact.captcha.enabled"; |
143 | 145 | private static final String CAPTCHA_PLUGIN = "captcha"; |
144 | 146 | private static final String EMPTY_STRING = ""; |
145 | 147 | private static final String ACTION_SEND_MESSAGE = "actionSendMessage"; |
@@ -201,7 +203,7 @@ public XPage getForm( HttpServletRequest request ) throws SiteMessageException |
201 | 203 |
|
202 | 204 | model.put( MARK_PORTAL_URL, strPortalUrl ); |
203 | 205 |
|
204 | | - boolean bIsCaptchaEnabled = PluginService.isPluginEnable( CAPTCHA_PLUGIN ); |
| 206 | + boolean bIsCaptchaEnabled = PluginService.isPluginEnable( CAPTCHA_PLUGIN ) && Boolean.parseBoolean( AppPropertiesService.getProperty( PROPERTY_CAPTCHA_ENABLED, "true" ) ); |
205 | 207 | model.put( MARK_IS_ACTIVE_CAPTCHA, bIsCaptchaEnabled ); |
206 | 208 |
|
207 | 209 | if ( bIsCaptchaEnabled ) |
@@ -426,7 +428,8 @@ public XPage doSendMessage( HttpServletRequest request ) throws SiteMessageExcep |
426 | 428 | } |
427 | 429 |
|
428 | 430 | // 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 ) |
430 | 433 | { |
431 | 434 |
|
432 | 435 | boolean isValid = _captchaService.isResolvable( ) ? _captchaService.get( ).validate( request ) : false; |
|
0 commit comments