Skip to content

Commit

Permalink
Captcha errors should be noted on cookies instead of session.
Browse files Browse the repository at this point in the history
Cornice 1 allowed us to note errors as belonging to the session,
but Cornice 3 does not allow this. validate_captcha() was still
doing things the Cornice 1 way which causes HTTP 500 errors. This
commit adjusts it to note the error on the cookies instead.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
  • Loading branch information
bowlofeggs committed Mar 6, 2018
1 parent d6c7651 commit 900e80a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bodhi/server/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,14 +1160,14 @@ def validate_captcha(request, **kwargs):
return

if 'captcha' not in request.session:
request.errors.add('session', 'captcha',
request.errors.add('cookies', 'captcha',
'Captcha cipher not in the session (replay).')
request.errors.status = HTTPBadRequest.code
return

if request.session['captcha'] != key:
request.errors.add(
'session', 'captcha', 'No captcha session cipher match (replay). %r %r' % (
'cookies', 'captcha', 'No captcha session cipher match (replay). %r %r' % (
request.session['captcha'], key))
request.errors.status = HTTPBadRequest.code
return
Expand Down

0 comments on commit 900e80a

Please sign in to comment.