Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12384 closed enhancement (fixed)

Don't show configuration section if captcha disabled

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version:
Severity: normal Keywords:
Cc: Dirk Stöcker Branch:
Release Notes:

The configuration section for a captcha is not shown on the Captcha admin panel if the captcha is disabled.

API Changes:
Internal Changes:

Description

For example, even if reCAPTCHA and reCAPTCHA2 are disabled, the following is displayed on the Captcha admin page:

Attachments (1)

Screen Shot 2016-03-04 at 19.28.49.png (59.0 KB ) - added by Ryan J Ollos 9 years ago.

Download all attachments as: .zip

Change History (4)

by Ryan J Ollos, 9 years ago

comment:1 by Ryan J Ollos, 9 years ago

Proposed patch to address reCAPTCHA and reCAPTCHA2. I'll follow the same pattern for the other captcha types.

  • tracspamfilter/admin.py

     
    2929from tracspamfilter.captcha import ICaptchaMethod
    3030from tracspamfilter.captcha.keycaptcha import KeycaptchaCaptcha
    3131from tracspamfilter.captcha.recaptcha import RecaptchaCaptcha
     32from tracspamfilter.captcha.recaptcha2 import Recaptcha2Captcha
    3233from tracspamfilter.filters.akismet import AkismetFilterStrategy
    3334from tracspamfilter.filters.blogspam import BlogSpamFilterStrategy
    3435from tracspamfilter.filters.botscout import BotScoutFilterStrategy
     
    679680            captcha = self.config.get('spam-filter', 'captcha')
    680681            captcha_karma_lifetime = self.config.get('spam-filter', 'captcha_karma_lifetime')
    681682
     683            captcha_recaptcha_enabled = \
     684                self.env.is_enabled(RecaptchaCaptcha) or \
     685                self.env.is_enabled(Recaptcha2Captcha)
    682686            captcha_recaptcha_private_key = self.config.get('spam-filter', 'captcha_recaptcha_private_key')
    683687            captcha_recaptcha_public_key = self.config.get('spam-filter', 'captcha_recaptcha_public_key')
    684688
     
    708712        data.update({'captcha': captcha,
    709713                     'types': captchas,
    710714                     'captcha_enabled': captcha_enabled,
     715                     'captcha_recaptcha_enabled': captcha_recaptcha_enabled,
    711716                     'captcha_recaptcha_private_key': captcha_recaptcha_private_key,
    712717                     'captcha_recaptcha_public_key': captcha_recaptcha_public_key,
    713718                     'captcha_keycaptcha_private_key': captcha_keycaptcha_private_key,
  • tracspamfilter/templates/admin_captcha.html

     
    4545          </label>
    4646      </div>
    4747
    48       <fieldset>
     48      <fieldset py:if="captcha_recaptcha_enabled">
    4949        <legend>reCAPTCHA</legend>
    5050        <p class="hint" i18n:msg="">
    5151          The reCAPTCHA system provides a very good captcha system based on

comment:2 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Implemented in [14586]. Related changes in [14587].

comment:3 by Ryan J Ollos, 9 years ago

New extraction in [14592].

Additional refactoring in:

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.