[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #11231 [BridgeDB]: BridgeDB's txrecaptcha returns the "No bridges available!" page if 'captcha_response_field' is blank
#11231: BridgeDB's txrecaptcha returns the "No bridges available!" page if
'captcha_response_field' is blank
--------------------------+--------------------------------------------
Reporter: isis | Owner: isis
Type: defect | Status: needs_review
Priority: blocker | Milestone:
Component: BridgeDB | Version:
Resolution: | Keywords: bridgedb-0.1.6, bridgedb-https
Actual Points: | Parent ID:
Points: |
--------------------------+--------------------------------------------
Changes (by isis):
* status: new => needs_review
Comment:
The unittests and fixes for this ticket are in my [ branch] and my [
branch]. 99% of the work is creating unittests, however there is a bugfix
in commit acf37dc00b4d9e2b8e3619a56f1711bb503d9e5b for the problem
mentioned in this ticket's description.
The other bugfix is in commit b4f88aded4fd6cc60be0129e1b6d0bd708d392c7 and
makes the following changes:
{{{
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
| AuthorDate: 6 hours ago
| Commit: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
| CommitDate: 6 hours ago
|
| Fix txrecaptcha.submit() to always return Deferreds.
|
| All returned Deferreds callback with RecaptchaResponse objects. This
| way, we do not need additional code to check if the result was a
| Deferred (because, in that case, we would need to add a callback
| function to extract the RecaptchaResponse object from it and check
it),
| or if it directly returned a RecaptchaResponse.
|
| This function now *always* returns Deferred.
| ---
| lib/bridgedb/txrecaptcha.py | 12 ++++++------
| 1 file changed, 6 insertions(+), 6 deletions(-)
|
| diff --git a/lib/bridgedb/txrecaptcha.py b/lib/bridgedb/txrecaptcha.py
| index e1e3234..2185112 100644
| --- a/lib/bridgedb/txrecaptcha.py
| +++ b/lib/bridgedb/txrecaptcha.py
| @@ -213,12 +213,12 @@ def submit(recaptcha_challenge_field,
recaptcha_response_field,
| :returns: A :api:`~twisted.internet.defer.Deferred` which will
callback
| with a ``recaptcha.RecaptchaResponse`` for the request.
| """
| - if not (recaptcha_response_field and
| - recaptcha_challenge_field and
| - len(recaptcha_response_field) and
| - len(recaptcha_challenge_field)):
| - return RecaptchaResponse(is_valid=False,
| - error_code='incorrect-captcha-sol')
| + if not (recaptcha_response_field and len(recaptcha_response_field)
and
| + recaptcha_challenge_field and
len(recaptcha_challenge_field)):
| + d = defer.Deferred()
| + d.addBoth(_ebRequest) # We want `is_valid=False`
| + d.errback(failure.Failure(ValueError('incorrect-captcha-sol')))
| + return d
|
| params = urllib.urlencode({
| 'privatekey': _encodeIfNecessary(private_key),
|
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11231#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs