Add endpoint to determine if CAPTCHAs will be reqiured.

This commit is contained in:
David Hu
2013-04-05 16:15:46 -07:00
committed by Neil Williams
parent 5e0d6a3884
commit b3c5ec23b7

View File

@@ -188,6 +188,15 @@ class ApiController(RedditController, OAuth2ResourceController):
if not (responder.has_errors("user", errors.BAD_USERNAME)):
return bool(user)
@json_validate()
@api_doc(api_section.captcha, extensions=["json"])
def GET_needs_captcha(self, responder):
"""
Check whether CAPTCHAs are needed for API methods that define the
"captcha" and "iden" parameters.
"""
return bool(c.user.needs_captcha())
@validatedForm(VCaptcha(),
name=VRequired('name', errors.NO_NAME),
email=ValidEmails('email', num = 1),