Added option to disable captcha verification

This commit is contained in:
gabe
2011-05-16 14:53:20 -07:00
committed by Neil Williams
parent e6178bedb1
commit 92fdd422fb
5 changed files with 8 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ INDEXTANK_API_URL =
# -- feature toggles --
disable_ads = false
disable_captcha = false
# -- important settings --
# the domain that this app serves itself up as

View File

@@ -432,7 +432,7 @@ class ApiController(RedditController):
form.has_errors("passwd", errors.BAD_PASSWORD) or
form.has_errors("passwd2", errors.BAD_PASSWORD_MATCH) or
form.has_errors('ratelimit', errors.RATELIMIT) or
form.has_errors('captcha', errors.BAD_CAPTCHA)):
(not g.disable_captcha and form.has_errors('captcha', errors.BAD_CAPTCHA))):
user = register(name, password)
VRatelimit.ratelimit(rate_ip = True, prefix = "rate_register_")

View File

@@ -89,6 +89,7 @@ class Globals(object):
'read_only_mode',
'frontpage_dart',
'allow_wiki_editing',
'disable_captcha',
]
tuple_props = ['stalecaches',

View File

@@ -207,7 +207,7 @@ class Account(Thing):
return id_time + ',' + sha.new(to_hash).hexdigest()
def needs_captcha(self):
return self.link_karma < 1
return self.link_karma < 1 and not g.disable_captcha
def modhash(self, rand=None, test=False):
return modhash(self, rand = rand, test = test)

View File

@@ -36,9 +36,11 @@
${login_panel(login_form,
user_reg = thing.user_reg, user_login = thing.user_login,
dest=thing.dest)}
%if not g.disable_captcha:
<script type="text/javascript">
$.request("new_captcha");
</script>
%endif
%endif
<%def name="login_form(register=False, user='', dest='', include_tos=True)">
@@ -101,8 +103,10 @@
${error_field("BAD_PASSWORD_MATCH", "passwd2", kind="span")}
</li>
<li>
%if not g.disable_captcha:
<% iden = hasattr(thing, "captcha") and thing.captcha.iden or '' %>
${captchagen(iden, tabulate=True, label=False, size=30)}
%endif
${error_field("RATELIMIT", "ratelimit")}
${error_field("RATELIMIT", "vdelay")}
</li>