Changeset 8415
- Timestamp:
- 11 May 2012, 06:30:36 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/browser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r8367 r8415 260 260 261 261 class EnquiriesForm(ContactAdminForm): 262 """Captcha'd page to let anonymous send emails to the administrator. 263 """ 262 264 grok.name('enquiries') 263 265 grok.require('waeup.Public') … … 266 268 'fullname', 'email_from', 'body') 267 269 270 def update(self): 271 # Handle captcha 272 self.captcha = getUtility(ICaptchaManager).getCaptcha() 273 self.captcha_result = self.captcha.verify(self.request) 274 self.captcha_code = self.captcha.display(self.captcha_result.error_code) 275 return super(EnquiriesForm, self).update() 276 268 277 @action(_('Send now'), style='primary') 269 278 def send(self, *args, **data): 279 if not self.captcha_result.is_valid: 280 # Captcha will display error messages automatically. 281 # No need to flash something. 282 return 270 283 kofa_utils = getUtility(IKofaUtils) 271 284 success = kofa_utils.sendContactForm( … … 480 493 self.widgets['title'].displayWidth = 30 481 494 self.widgets['description'].height = 3 495 return 482 496 483 497 @action(_('Save'), style='primary') -
main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/contactform.pt
r8078 r8415 18 18 </tal:block> 19 19 20 <div tal:condition="view/availableActions"> 21 <input tal:repeat="action view/actions" 22 tal:replace="structure action/render" 23 /> 24 </div> 20 <tal:captcha condition="view/captcha_code|nothing"> 21 <p tal:content="structure view/captcha_code"></p> 22 <p i18n:translate=""> 23 Please solve the captcha to prevent misuse of this service. 24 </p> 25 </tal:captcha> 26 27 <div tal:condition="view/availableActions"> 28 <input tal:repeat="action view/actions" 29 tal:replace="structure action/render" 30 /> 31 </div> 25 32 </form>
Note: See TracChangeset for help on using the changeset viewer.